New SAS User

Completely new to SAS or trying something new with SAS? Post here for help getting started.
BookmarkSubscribeRSS Feed
Dynamike
Calcite | Level 5

Hi all,

 

i have the following data set:

 

ID   MONTH    YEAR

x     2               2015

y     4               2015

z     10             2016

 

Now i want to create a date variable with given month and year as well as the last day of the month:

 

Data test;
Set test;
Date=MDY(MONTH,31,YEAR);
format  date ddmmyy10.;
run;

 

But this only works for ID z because October consists of 31 days, but February (28) and April (30) not.

 

Is there any function, which automatically generates the day information as last day for the given month?

 

Thank you for ur effort!

Mike

1 REPLY 1

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 7623 views
  • 4 likes
  • 2 in conversation