Help using Base SAS procedures

creating new date variable from separate month and year

Reply
N/A
Posts: 1

creating new date variable from separate month and year

I am merging two datasets - one dataset has the date recorded as separate month and year variables. I want to convert these into a single variable for the date in the format mm.yyyy, to match the date variable in the second dataset.
Is this possible? Any advice is appreciated
Super Contributor
Super Contributor
Posts: 365

Re: creating new date variable from separate month and year

Hello BenRB,

You could use the following code:
[pre]
data i;
month=5;
year=2011;
date=MDY(month,01,year);
format date mmyyp8.;
run;
[/pre]
Sincerely,
SPR
Ask a Question
Discussion stats
  • 1 reply
  • 95 views
  • 0 likes
  • 2 in conversation