Date: Wed, 30 May 2001 10:06:12 -0400
Reply-To: "Goldman, Brad (AT-Atlanta)" <Brad.Goldman@AUTOTRADER.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Goldman, Brad (AT-Atlanta)" <Brad.Goldman@AUTOTRADER.COM>
Subject: %do loop -- the answer
Content-Type: text/plain; charset="iso-8859-1"
The issue was: How can I keep the leading zeros in a %do loop, where I want
to go from 0401 to 0430 (April 1 - April 30)? Left to it's on devices, SAS
interprets each value of the %do loop as 401, 402, 403, etc.
Of course, the mighty Paul Dorfman had the solution to my problem. Enclose
the following in macro code:
*************;
%do i = &beg %to &end;
proc append base=wc.mtd data=wc.wc%sysfunc(int(&i),z4.) force;
run;
%end;
*************;
I was very surprised that one could just throw a %sysfunc right in the
middle of a dataset name like that, but it work perfectly.
Thank you Paul!
-Brad Goldman
|