Date: Thu, 21 Apr 2011 14:19:05 -0700
Reply-To: "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Terjeson, Mark" <Mterjeson@RUSSELL.COM>
Subject: Re: writing macro
In-Reply-To: A<201104212039.p3LIrAke015916@waikiki.cc.uga.edu>
Content-Type: text/plain; charset="us-ascii"
Hi Jenny Lee,
Normally I always provide sample code, but
am heading off to some meetings. However,
Since you can use functions in the PROC SQL
"select" clause and you can use CASE WHEN THEN
to replace the IF THEN from the datastep, you
can write the corollary of the datastep into
a PROC SQL just fine. If you get stuck someone
will help you. You don't need macro, so not
sure what you want to do with that....
Mark
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Jenny Lee
Sent: Thursday, April 21, 2011 1:39 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: writing macro
I would like to write the following using proc sql with macro. Thank
you.
need to pick:
100.x1 (= 100.01 100.21 100.31 etc. )
120.x1
120.x2
130.x1
130.x2
130.x3
data one;
input thecode $;
datalines;
100.01
100.21
100.22
100.31
100.32
120.01
120.02
120.21
120.22
120.32
120.21
120.22
120.32
130.53
;
run;
data two;
set one;
aa=substr(thecode, 1, 3);
aaa=substr(thecode, 5, 2);
if (aa in ("100") and aaa in ("01"))
or (aa in ("120") and aaa in ("01","02")
or (aa in ("130") and aaa in ("01","02","03"));
run;
|