Date: Tue, 26 Aug 2008 07:57:17 -0700
Reply-To: jamesgreen55@YAHOO.CA
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: jamesgreen55@YAHOO.CA
Organization: http://groups.google.com
Subject: Variable names as Macro Value?
Content-Type: text/plain; charset=ISO-8859-1
Hi all; I'm stumped as everytime I create a list of the applicable
variables as a macro value, rather than processing each indivudual
name it errors out and processes as one long string.
To keep things simple my sample below contains 3 Date variables in
text format including some junk info I'll need to clean, in my data
there are closer to 40 vars and I 'd rather not repeat the informat/
format/clean etc. statements 40x... also I'd rather not rename the
varname when using the input statement (added a 2 in the sample but
it's not required)...
Can someone point me in the right direction?
data xx;
input RecDat $1-8 ShpDat $10-17 CallDat $19-26;
cards;
20071019 20071029 20071030
20071116 20071120 20071121
20071120 20071120 20071121
20071030 20071031 20071105
20071030 20071030 20071031
0 0 0
20080129 20080130 20080131
20071030 20071108 20071109
0 0 0
20071115 20071213 20071214
;
run;
data yy(drop=RecDat ShpDat CallDat); set xx;
if RecDat ='0' or ShpDat ='0' or CallDat='0' then delete;
*more junk cleaning...;
RecDat2=input(RecDat,yymmdd8.);
ShpDat2=input(ShpDat,yymmdd8.);
CallDat2=input(CallDat,yymmdd8.);
*etc...;
format RecDat2 ShpDat2 CallDat2 mmddyy10.;
*etc...;
*remove "2" from varnames...;
run;