BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Sharan
Obsidian | Level 7

Hi there!

I have 3 variables: a  month column and a year column and a day column. The day column with have the value 15 referring to mid-month and will be constant. Now using the 3 fields, I would like to create a Date column in Date9. Format. How do I do this?

 

Sample Data

Obs

Month

Year

Day

1

5

2008

15

2

8

2009

15

3

4

2010

15

4

9

2005

15

 

New Data

 

Obs

Month

Year

Day

New_Date

1

5

2008

15

15May2008

2

8

2009

15

15Oct2009

3

4

2010

15

15Apr2010

4

9

2005

15

15Sep2005

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26
data want;
    set have;
    new_date=mdy(month,day,year);
    format new_date date9.;
run;
--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26
data want;
    set have;
    new_date=mdy(month,day,year);
    format new_date date9.;
run;
--
Paige Miller
Sharan
Obsidian | Level 7
Hi Paige Miller, Brilliant!
Thank you for the swift response to my question and yes it worked. Hugely appreciate the support!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 6905 views
  • 2 likes
  • 2 in conversation