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.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.