BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
vomer
Obsidian | Level 7

Hi there, I would like some help with the following macro:

%let dt = %SYSFUNC(today(),MONYY.);

This outputs the result: MAY13

How can this code be modified to show the previous month? i.e. APR13?

Secondly, how can I make it look a bit different? Let's say like: April 2013

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
data_null__
Jade | Level 19
17         %let dt = %sysfunc(intnx(MONTH,%SYSFUNC(today()),-1),MONYY.);
18         %put &=dt;
DT=APR13

View solution in original post

4 REPLIES 4
data_null__
Jade | Level 19
17         %let dt = %sysfunc(intnx(MONTH,%SYSFUNC(today()),-1),MONYY.);
18         %put &=dt;
DT=APR13
vomer
Obsidian | Level 7

Thank you!

Tom
Super User Tom
Super User

I do not know of a single format to get "April 2013" output.  I think you will need to use two function calls.

%let dt = %sysfunc(intnx(MONTH,%SYSFUNC(today()),-1));

%let dt = %sysfunc(putn(&dt,monname.)) %sysfunc(putn(&dt,year.));

ChrisNZ
Tourmaline | Level 20
%let x=%sysfunc(nldate('01dec2013'd,%nrstr(%B %Y)));

%put x=&x;

x=December 2013

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 4 replies
  • 977 views
  • 4 likes
  • 4 in conversation