BookmarkSubscribeRSS Feed
ren2010
Obsidian | Level 7
Hi,

I have a requirement suppose I have customer data(name,enrolldate)
I want to change the enrolldate to the end of that particular month

eg: james 12/01/2007
roby 11/10/2009
mary 02/26/2009


my desired output is:

james 12/31/2007
roby 11/30/2009
mary 02/28/2009

Please help.
3 REPLIES 3
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Using a DATA step, explore using the INTNX function in a SAS assignment statement, either to create a new variable (with the desired output FORMAT) or to change the value of an existing variable.

Scott Barry
SBBWorks, Inc.

Recommended Google advanced search argument:

change date end of month site:sas.com

intnx function site:sas.com
ren2010
Obsidian | Level 7
Thanks Scott
deleted_user
Not applicable
data initial;
input name $ customer_date MMDDYY10.;
datalines;
james 12/01/2007
roby 11/10/2009
mary 02/26/2009
;
run;

data end_of_month;
set initial;
c_date=intnx('month', customer_date, 0, 'end');

proc print
data=end_of_month;
format customer_date c_date MMDDYY10.;
run;

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!

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