Date: Thu, 16 Dec 2004 11:08:33 +1100
Reply-To: Scott <usenet739_yahoo_com_au@CRONKITE.CC.UGA.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Scott <usenet739_yahoo_com_au@CRONKITE.CC.UGA.EDU>
Subject: Re: Need some help with a simple SAS program (using macros).....
Hi Aaron,
I gave a presentation on using macro at our recent SAS User's Group meeting.
Perhaps this would be useful in getting you quick started?
You can download the relevant files as follows:
Presentation:
http://www.sas.com/offices/asiapacific/sp/usergroups/snug/GettingFunky.ppt
Sample Code:
http://www.sas.com/offices/asiapacific/sp/usergroups/snug/GettingFunkyWithMacroSampleSASCode.zip
Some quick comments on your below scenario:
* Learn how SAS compiles its code (data step, procedures, open code)
* Learn how macro interacts with the compile and run time steps
* Learn when and, just as important, when NOT to use macro
* Learn variable lists and data step arrays
The below scenario is an example of when you should not use macro. Just use
data set options as follows:
data one;
do y=1 to 50;
output;
end;
length x1-x50 8;
run;
proc print;
run;
data two;
set one (firstobs=20 obs=35 keep=y x10-x20);
run;
proc print;
run;
Hope this helps,
Scott
"HoMoon115" <homoon115@yahoo.com> wrote in message
news:1103086756.447163.232990@f14g2000cwb.googlegroups.com...
> I'm teaching myself how to use SAS and I've come across a situation
> where I'm not quite sure what the correct syntax would be. Anyone have
> any suggestions?
>
> I have a dataset with 4 variables, one of which is called "obs". There
> are 50 observations. I'm trying to learn how to use macros. How can I
> utilize the macros function to keep specific ranges of observations.
> For example say I want to keep all the variables associated with
> observations 20-35.
> Any help would be much appreciated.
>
> Thanks,
> Aaron
>