I am trying to create a function that creates a numeric variable called BirthDt that basically combines the BirthYear, BirthMonth and BirthDay into one numerical variable, ie so the BirthDt for the first observation would be 199. I am struggling with which function to actually use for this. Any advice?
MDY is the one to use here:
BirthDate = mdy(BirthMonth, BirthDay, BirthYear);
format BirthDate date9.;
MDY is the one to use here:
BirthDate = mdy(BirthMonth, BirthDay, BirthYear);
format BirthDate date9.;
Thanks! That worked perfectly. There are so many date functions, I was struggling finding one to use.
Good to hear. You are right, there are a lot of date functions and it can be hard to find a suitable one.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Get started using SAS Studio to write, run and debug your SAS programs.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.