Date: Tue, 23 Sep 2003 10:54:14 -0700
Reply-To: Chang <chang_y_chung@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Chang <chang_y_chung@HOTMAIL.COM>
Organization: http://groups.google.com/
Subject: Re: dates issue...
Content-Type: text/plain; charset=ISO-8859-1
Hi, jcern15,
How about using intnx() function in data step and output an
observation per month. An example is in the following:
SAS -----------------------------------------------------
data one;
from = '01Jan2000'd;
to = '15Mar2003'd;
from_month = intnx('month', from, 0);
to_month = intnx('month', to, 0);
do while (from_month <= to_month);
month = month(from_month);
year = year(from_month);
* put from= :mmddyy10. to= :mmddyy10. month= year=;
keep from to month year;
output;
from_month = intnx('month', from_month, 1);
end;
run;
---------------------------------------------------------
Cheers,
Chang
jcern15@yahoo.com (jcern) wrote in message news:<36e53d3f.0309230640.47729528@posting.google.com>...
> I am having trouble with date conversions for a particular function.
> I have to change a single date period to multiple records of months
> and years. For example, I have to change a date period of let's say,
> 1/1/00-3/15/01 to multiple records of: 1/00, 2/00,3/00,4/00 up until
> 3/01. In other words, I need the date period broken down into
> month/year dates for each month and year of the time period. I
> realize this is going to result in MANY records, but that is how I
> have to format this, unfortunately.
>
> Does anyone have any idea how to go about doing this?
>
> Thanks!
|