Date: Mon, 23 Jul 2007 10:19:47 -0500
Reply-To: "Paul A. Thompson" <paul@WUBIOS.WUSTL.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Paul A. Thompson" <paul@WUBIOS.WUSTL.EDU>
Subject: Re: Date Calculation
Content-Type: text/plain; charset="us-ascii"
SAS allows you to do a lot of things that you probably should not be doing.
This is a lovely example. END is a control word. MONTH is a control word.
Yes, control words can be used as variables, but why in the name of Cluthlu
would you want to do that? I would begin by changing END to PER_END, START
to PER_START, and MONTH to XMONTH or something. Similarily with date.
Paul A. Thompson, Ph.D.
Division of Biostatistics, Washington University School of Medicine
660 S. Euclid, St. Louis, MO 63110-1093
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Sent: Monday, July 23, 2007 10:09 AM
Subject: Date Calculation
Hello, I'm trying to create macros containing the first date of the
month for all months in between certain dates (in the case below, it
is a calendar year, but this will not be the case every time).
The bold part of the program (macro dates_month)is not working for me;
I'm not sure why. I'm not concerned with the actual values at this
point, I'm just trying to figure out why macros &Date1 - $Date12 are
not being created.
Also, if there is a better way to do this (create macros containing
the first date of the month for all months in between certain dates),
please let me know.
Start = put(intnx('month',today(),-14),date9.);
firstday = intnx('month',today(),-2);
End = put((firstday - 1),date9.);
%put(Start) = &Start;
%put(End) = &End;
%put(Month) = &Month;
%do I = 1 %to 12;
Date&I = intnx('month',&Start,&I);
%put(Date1) = &Date1;[/b]