LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (July 2007, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 23 Jul 2007 16:08:04 +0000
Reply-To:     toby dunn <tobydunn@HOTMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         toby dunn <tobydunn@HOTMAIL.COM>
Subject:      Re: Date Calculation
Comments: To: stavenj@GMAIL.COM
In-Reply-To:  <1185203353.045669.312200@w3g2000hsg.googlegroups.com>
Content-Type: text/plain; format=flowed

Joe ,

I think you need to be concerned abotu your approach here. Why do you need all the dates in a year? And how do you define your year?

Toby Dunn

If anything simply cannot go wrong, it will anyway. Murphys Law #2.

The buddy system is essential to your survival; it gives the enemy somebody else to shoot at. Murphys Law #

Tell a man there are 300 billion stars in the universe and he'll believe you. Tell him a bench has wet paint on it and he'll have to touch to be sure. Murphys Law #9

From: stavenj@GMAIL.COM Reply-To: stavenj@GMAIL.COM To: SAS-L@LISTSERV.UGA.EDU Subject: Date Calculation Date: Mon, 23 Jul 2007 08:09:13 -0700

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. Thanks, Joe

%macro date_calc;

data _null_; Start = put(intnx('month',today(),-14),date9.); call symput('Start',"'"||Start||"'d"); run;

data _null_; firstday = intnx('month',today(),-2); End = put((firstday - 1),date9.); call symput('End',"'"||End||"'d"); run;

%mend date_calc; %date_calc;

data _null_; MONTH= INTCK('MONTH',&start,&End+1); call symput('MONTH',(Month)); run;

%put(Start) = &Start; %put(End) = &End; %put(Month) = &Month;

[b]%macro dates_month; %do I = 1 %to 12; data _null_; Date&I = intnx('month',&Start,&I); call symput("Date&I",Date&I); run; %end; %mend; %dates_month;

%put(Date1) = &Date1;[/b]

_________________________________________________________________ http://newlivehotmail.com


Back to: Top of message | Previous page | Main SAS-L page