Date: Fri, 5 Aug 2005 00:47:11 -0700
Reply-To: Sarav <sarav.sas@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Sarav <sarav.sas@GMAIL.COM>
Organization: http://groups.google.com
Subject: Basic help regarding MACROS
Content-Type: text/plain; charset="iso-8859-1"
Hi all,
I am a rookie programmer in SAS. I was trying to learn SAS Macros and I
got myself into a real mess in a basic step. I need to store a variable
list to a macro variable and then export the variable list in another
variable.
I have a data set flights.diabetes which has 20 records in a character
variable 'ID'. I am trying to store the entire 20 records into
'varlist'. Then I would like to create a new dataset 'new' and would
like to transfer all the 20 records to a new variable 'wt' in the new
dataset.
I tried the following code:
data _null_;
set flights.diabetes;
allid = left(id);
call symput('varlist', allid);
run;
%put &varlist;
data new;
wt = &varlist;
run;
All I get in 'wt' is the last value of ID. What should I do to get the
entire list of values. Should I try to use arrays to store the entire
list?
It would be great if you guys can help me on this as I presume simple
MACRO concept.
Thanks,
Sarav