Date: Thu, 3 Jul 2008 06:20:58 -0400
Reply-To: Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Subject: Re: how to access the data of a dataset?
if you really want to have 1 value of a whole SAS table, why you want to
use a new TABLE for that?
I think I also do not understand, what you really want, to get one value of
a whole table, look at the following example:
set sashelp.class point=x;
Fetchs the value of AGE from the 5th obs.
On Thu, 3 Jul 2008 01:41:39 -0700, Daniel Nordlund <djnordlund@VERIZON.NET>
>> -----Original Message-----
>> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
>> Sent: Thursday, July 03, 2008 12:51 AM
>> To: SAS-L@LISTSERV.UGA.EDU
>> Subject: Re: how to access the data of a dataset?
>> On 2 Lug, 17:47, Nord...@DSHS.WA.GOV ("Nordlund, Dan (DSHS/RDA)")
>> >If you write back to SAS-L with a description of the problem that
>> you are trying to solve, someone will be able to get you started in
>> the right direction.
>> I need to access to a dataset by considering the observation number
>> and the variable number.
>> For example, if "tb" is my sas dataset, how can I access to this data
>> without using the proc iml?
>> If I consider the proc iml, I can do:
>> proc iml;
>> use tb;
>> read all into mtx;
>> and so on.
>> I want to obtain the data of tb (observation 1, variable 2) without
>> using the proc iml.
>> For example, how to create a sas dataset with only a value equal to
>> the observation 1 and the variable 2 of tb? ("calling" this value by
>> considering the position into the dataset tb, that is: observation 1
>> and variable 2).
>> What a document freely downloadable and printable (perhaps in pdf) to
>> better understand sas? The link suggested by Michael A. Raithel is
>> great but you can not print on paper.
>> thank you
>Well, I can tell you how to do what you ask for, but you don't really want
to do it. It is almost certainly the wrong thing to do. I will assume
that all your variables in tb are numeric and that tb is randomly
accessible (e.g. on disk). You could do something like
>**----here is some data----**;
> array v[*] v1-v10;
> do _n_ = 1 to 100;
> do _j = 1 to 10;
> v[_j] = normal(53172);
>drop _: ;
>**----select the value of the second variable in observation 1----**;
> obsnum = 1;
> varnum = 2;
> set tb point = obsnum;
> array v[*] _numeric_;
>Now that I have shown you how to get what you asked for, let me say again
that you don't want to do this. This is the wrong way to think about data
step programming. It is possible to load values into an array in a data
step much as you would in Proc iml, but that may not be what you ought to
be doing either. Without knowing what your real programming task is (the
real problem you are trying to solve), I really can't offer what I believe
is good advice.
>As an aside, I believe the online SAS documentation that Michael Raithel
pointed to is available in pdf format.
>Bothell, WA USA