Date: Wed, 23 Aug 2006 11:06:14 -0700
Reply-To: dlsac <dwlafferty@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: dlsac <dwlafferty@GMAIL.COM>
Organization: http://groups.google.com
Subject: Array help
Content-Type: text/plain; charset="iso-8859-1"
Here is a portion of code from a macro that reads in a sequence of text
files in the format MMDD. Within the month it increments by one day:
example: 0101,0102,0103 etc. or 1001,1002,1003 etc.
%IF %EVAL (%SUBSTR(&DNAME,1,1) = 0) %THEN %DO;
%LET DNAME = %CMPRES(%SUBSTR(&DNAME,1,1)%EVAL(%SUBSTR(&DNAME,2,3)+ 1));
%END;
%IF %EVAL (%SUBSTR(&DNAME,1,1) > 0) %THEN %DO;
%LET DNAME = %CMPRES(%EVAL(%SUBSTR(&DNAME,1,4)+ 1));
%END;
For files that progress through different months (example:
0131,0201,0202 etc.) I use this code:
%IF %EVAL (%SUBSTR(&DNAME,1,4)) = 0132 %THEN %DO;
%LET DNAME = %CMPRES(0201);
%END;
%IF %EVAL (%SUBSTR(&DNAME,1,4)) = 0229 %THEN %DO;
%LET DNAME = %CMPRES(0301);
%END;
%IF %EVAL (%SUBSTR(&DNAME,1,4)) = 0332 %THEN %DO;
%LET DNAME = %CMPRES(0401);
%END;
...etc.
How can I put this second section into an array?
|