BookmarkSubscribeRSS Feed
anirudhs
Obsidian | Level 7

Hi ,

I am looking for code to extract only the data with last day of the month.

eg. if a dataset contains incremental data of every day and from that data i need to filter only the data for last day of every month.

 

linke if my data is having 6 months of data like from Jan to June the i want to have data as per only last day of every month, i.e 31stjan, 28th feb,31march,30april,31may,30june,31july etc.

 

 

2 REPLIES 2
shahparth260
Quartz | Level 8

so , I am telling you what my understanding is  based on your requirement that  you want to have data only for those dates ?

 

if you can explain by putting example would be more clear. 

 

Thanks 

PS
PGStats
Opal | Level 21

Assuming that your dates are SAS dates, you can select dates that are the last day of the month with the condition

 

if date = intnx("MONTH", date, 0, "END");

PG

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1904 views
  • 3 likes
  • 3 in conversation