BookmarkSubscribeRSS Feed
oht
Calcite | Level 5 oht
Calcite | Level 5

Hi ,

I need to calculate in the end of the month day (e.i. 30,31,28,29) . Does anybody has any idea ?

Thanks

4 REPLIES 4
Amir
PROC Star

Hi,

Does the following help:

http://support.sas.com/kb/31/443.html

Regards,

Amir.

oht
Calcite | Level 5 oht
Calcite | Level 5

That's what I am looking for. Thanks for your help !!

art297
Opal | Level 21

You didn't indicate anything about your data.  If they are just date fields and you want to know how many days were in the month represented by the dates you could use something like:

data have;

  input havedate date9.;

  format havedate date9.;

  days_in_month=day(intnx('month',havedate,0,'e'));

  cards;

03OCT2012

;

Linlin
Lapis Lazuli | Level 10

Exactly the same:

data have;

  input date mmddyy10.;

  format date mmddyy10.;

  cards;

  01/23/2012

  02/04/2012

  09/21/2012

  ;

  data want;

    set have;

day_at_end_of_month=day(intnx('month',date,0,'e'));

proc print;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!

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