| Date: | Tue, 5 Jan 2010 15:07:20 -0600 |
| Reply-To: | "Data _null_;" <iebupdte@GMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "Data _null_;" <iebupdte@GMAIL.COM> |
| Subject: | Re: chop dates into month |
|
| In-Reply-To: | <5947c4ba-6838-4791-90ea-876283cc204f@c3g2000yqd.googlegroups.com> |
| Content-Type: | text/plain; charset=ISO-8859-1 |
|---|
Like Joe said INTNX with alignment parameter. This may be close to
what he was thinking. Sept has 30 days.
data have;
input id (begin end)(:mmddyy.);
do d = begin to end;
bdate = intnx('month',d,0,'B');
edate = intnx('month',d,0,'E');
output;
d = edate;
end;
format begin end bdate edate mmddyy.;
drop d;
cards;
1 06/18/07 09/28/07
;;;;
run;
proc print;
run;
On 1/5/10, Larry <song.lihai@gmail.com> wrote:
> Dear SAS-L,
>
> I am doing data manipulation but stuck by this issue. I have data
> like;
>
> id begin end ;
> 1 06/18/07 09/28/07;
>
> I want my data to be chopped by month, so desired data will be like;
>
> id begin end bdate edate
> 1 06/18/07 09/28/07 06/01/07 06/30/07
> 1 06/18/07 09/28/07 07/01/07 07/31/07
> 1 06/18/07 09/28/07 08/01/07 08/31/07
> 1 06/18/07 09/28/07 09/01/07 09/31/07
>
> Any advice will be appreciated.
>
|