BookmarkSubscribeRSS Feed
anitapamu2
Calcite | Level 5

data _null_;
td=today();
*td='18jul2014'd;

bgn_date=intnx('month',td,0,'b');
end_date=intnx('month',bgn_date,0,'e');
prev2mth=intnx('month',td,-2,'s');
call symput('As_of_dte',put(td,yymmdd8.));
call symput('As_of_dt',put(td,yymmdd10.));
call symput('As_of_dte1',put(td-1,yymmdd8.));
call symput('month_begin',put(bgn_dte,yymmdd10.));
call symput('month_end',put(end_dte,yymmdd10.));
call symput('month_stamp',put(bgn_date,yymmn6.));
call symput('prev2mth',put(prev2mth,yymmddn8.));
run;

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Hi,

Sorry, am not following.  Please provide test data, as a datastep, and required output.

ballardw
Super User

Note: All SAS date values are days since 1 Jan 1960. So they are already "days".

You can get day of the month with the DAY function.

You can get day of the year using Juldate and Mod functions.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2 replies
  • 726 views
  • 0 likes
  • 3 in conversation