BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,

I need to create a monthly report. For that i have created a macros,

data _null_;
call symput ('begindt',intnx('MONTH',today(),-4));
call symput ('enddt',intnx('MONTH',today(),-3));
call symput ('rdate',put(today(),date9.));
run;

If run this code , %put &begindt ; am getting SAS date.
If i want to see in ddmmyyyy means how to convert the code ?

Pls anyone let me know..

Thanks,
sudha
5 REPLIES 5
ArtC
Rhodochrosite | Level 12
Use %SYSFUNC with the PUTN function.
[pre]
%let begindt = 18234;
%put %sysfunc(putn(&begindt,ddmmyy10.));[/pre]
deleted_user
Not applicable
Hi ,

Thanks for your reply...
But if i ran that syntax

%put %sysfunc(putn(&begindt,ddmmyy10.));

am getting an output as 01/01/1960..

But i need to get an output as 09/01/2010.

please let me know..

Thanks,
sudha
SPR
Quartz | Level 8 SPR
Quartz | Level 8
Hello Sudcha,

I tried ArtC's suggestion on my computer. This code works as expected:
[pre]
data _null_;
call symput ('begindt',intnx('MONTH',today(),-4));
run;
%put begindt=%trim(&begindt);
%put %sysfunc(putn(&begindt,ddmmyy10.));
[/pre]
Sincerely,
SPR
deleted_user
Not applicable
Yes am getting an exact output what am expecting !!

Thank you !!!
PatrickG
SAS Employee
You can find out more about using SAS dates here. I hope this helps.

http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a002200738.htm

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 775 views
  • 0 likes
  • 4 in conversation