View previous topic :: View next topic |
Author |
Message |
mls Beginner
Joined: 10 Nov 2005 Posts: 9 Topics: 5
|
Posted: Thu Nov 10, 2005 5:20 am Post subject: SAS Problem: Date print Problem |
|
|
Hi,
My requirement is to print Previous month and date of current year and last year in a report using SAS. e.g if I run it on 11/10, the report should have 30OCT2004 to 30OCT2005.
I am also using these dates for comparison in SQL and I am using
(CURRENT_DATE - DAY(CURRENT_DATE) DAYS) - 1 YEAR) and (CURRENT_DATE - DAY(CURRENT_DATE) DAYS) and it is working in SQL.
But when I am trying to assign this value to a variable in SAS, it is not working.
Thanks a lot for your help,
Regards,
MLS |
|
Back to top |
|
|
vkphani Intermediate
Joined: 05 Sep 2003 Posts: 483 Topics: 48
|
Posted: Thu Nov 10, 2005 5:27 am Post subject: Re: SAS Problem: Date print Problem |
|
|
Please post your SAS code. |
|
Back to top |
|
|
jetson Beginner
Joined: 07 Oct 2005 Posts: 30 Topics: 2 Location: Texas
|
Posted: Thu Nov 10, 2005 4:46 pm Post subject: |
|
|
Use the INTNX function: example below
data test;
date='10nov05'd;
prev_month_date = intnx('month',date,-1,'e');
prev_year_date = intnx('month',prev_month_date,-12,'e');
put date mmddyy10.;
put prev_month_date mmddyy10.;
put prev_year_date mmddyy10.;
run; |
|
Back to top |
|
|
|
|