| Date: | Fri, 28 May 2004 09:45:24 -0400 |
| Reply-To: | Mark Biek <markb@STEVENSONCOMPANY.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Mark Biek <markb@STEVENSONCOMPANY.COM> |
| Subject: | How to save the formatted value of a date |
| Content-Type: | text/plain; charset=us-ascii; format=flowed |
I have the following macro which just increments a date by a certain
number of weeks and saves each new date to a dataset, then creates a
macro variable for each date.
The problem is that the macro variables are the unformatted dates:
16182
16189
16196
16203
What I'd really like to put into the macro variable are the formatted dates:
04-21-04
04-28-04
05-05-04
05-12-04
What's the best way to go about this?
%macro TestDate(startDate, numWeeks);
%local idx;
data dates;
%do idx = 1 %to &numWeeks;
yr&idx = intnx( 'day', "&startDate"d, %eval(&idx+ (6*&idx)));
format yr&idx mmddyyd8.;
%end;
run;
proc transpose data=dates out=dates_t prefix=date;
run;
data _null_;
set dates_t;
iDate+1;
iiDate = left(put(iDate,3.));
call symput( 'Date'||iiDate, date1);
call symput( 'tDate', iiDate );
run;
%do idx = 1 %to &tDate;
%put &&Date&idx;
%end;
%mend TestDate;
%TestDate( 14Apr04, 4 );
--
Mark Biek
The Stevenson Company
8700 Westport Rd. Ste. 200
Louisville, KY 40242-3100
(502) 429-9060 ext 251
|