Date: Thu, 11 Jan 2007 00:00:24 -0800
Reply-To: David L Cassell <davidlcassell@MSN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: David L Cassell <davidlcassell@MSN.COM>
Subject: Re: arrays in PROC steps
Content-Type: text/plain; format=flowed
jelkink@GMAIL.COM wrote back:
>On 1/6/07, David L Cassell <firstname.lastname@example.org> wrote:
>>me>>SAS is designed to work with tall-and-thin data sets, so you
>>me>>may be thinking in a very non-SAS-ish manner here and getting
>>me>>yourself into all kinds of difficulties.
>>Let me give you an example of what I have in mind here.
>>You certainly *could* have a data set like this:
>>ID Time1 Time2 Time3 . . . . Time96
>>12 47.55 98.32 74.14 . . . . . . .
>>13 . . . .
>>14 . . . .
>>. . . . . .
>>But now you have wedged your time information into the
>>variable names, and you have created something hard to
>>work with in time series procs.
>>If, instead, you built your data set like this:
>>ID Time FergleIndex
>>12 1 47.55
>>12 2 98.32
>>12 3 74.14
>>. . . . . .
>Thanks for all the kind responses again about this question. As I
>said, I am helping someone else with the use of SAS, so I cannot give
>any more details than the ones passed on to me, but it seems that the
>user indeed is looking at a panel-dataset which is in the wide instead
>of the long format (or 'thin' if you wish :) ...). I hadn't deduced
>that from her question about arrays - I'm quite impressed you guys did
>:) ... Is there an easy way in SAS to go from one to the other,
>similar to Stata's reshape command?
>And for as far as it is not related to this panel dimension of the
>data, is there something similar to:
>array ABC(*) a b c;
>do I = 1 to dim(ABC);
> plot ABC(I)*d;
>in the PROC block?
I didn't deduce it. I used my crystal ball, which gets kind of cloudy
at this time of year in Oregon. :-) No, I've seen this type of problem
many times before, so I guessed.
As for the 'array' issue, I think you need to look into the features
of the SAS procs. Most SAS procs have capabilities that parallel
this, depending on your needs. For example, you could write the
plot (a b c)*d;
Or you could take advantage of SAS list structures. Go into the
SAS OnlineDoc(R) and look up:
-> SAS Language Reference: Concepts
-> SAS System Concepts
-> SAS Variables
-> SAS Variable Lists
You'll find that there are a number of ways of using built-in
list forms for lists of variables. Then you can use those
variable list forms wherever iti s legit to give a series of SAS
So take a look at the syntax for several different procs. Anywhere
the syntax says that you can use "variable(s)" you can give it
a list of variables.
So tools like PROC MEANS, PROC FREQ, ... can take a series of
variables instead of just a single variable. But that doesn't mean
that one *should* keep one's data in a form which forces one
into looking for such problems. My guess is that the 'panel data'
are crying out for a good dose of PROC TRANSPOSE so that
they can be analyzed properly later on.
David L. Cassell
3115 NW Norwood Pl.
Corvallis OR 97330
Get live scores and news about your team: Add the Live.com Football Page