Dears,
I have a partial date like "2002" ,Is there any function that can fill in "2002" as "2002-01-01"? And there are similar ones,fill in "2002-01-01T01" as "2002-01-01T01:00"
Thanks
For the partial date question, use the B8601DA Informat
data _null_; dt1 = "2002"; dt2 = input(dt1, B8601DA.); put dt2 yymmdd10.; run;
For the partial datetime question, use the B8601DT informat
data _null_; dt1 = "2002-01-01"; dt2 = input(dt1, B8601DT.); put dt2 E8601DT.; run;
Afaik no such function exists. You could use mdy to create a date when you have the year, only.
For the partial date question, use the B8601DA Informat
data _null_; dt1 = "2002"; dt2 = input(dt1, B8601DA.); put dt2 yymmdd10.; run;
For the partial datetime question, use the B8601DT informat
data _null_; dt1 = "2002-01-01"; dt2 = input(dt1, B8601DT.); put dt2 E8601DT.; run;
Anytime 🙂
No. You need to use the INTNX function to get the end date of the respective period.
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 save with the early bird rate—just $795!
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.
Ready to level-up your skills? Choose your own adventure.