I have dates stored in a numeric variable of the form YYYYMMDD, with no separator between the day month and year parts. An example is 20090629. I wish to store it in a SAS date field. I am using the following line:
xPolSD = Input(PolSD,yymmddn8.);
but which is giving me an error. I have also tried using
xPolSD = Input(PolSD,yymmdd8.);
which also gives an error.
What is the correct SAS informat to use in this instance?
Thank you for your feedback.
hope the below code will be more understandable
data have;
input date $;
new_date=input(date,yymmdd8.);
format new_date date9.;
cards;
20090629
;
run;
Thanks,
Jagadish
You need to put your date first, so it becomes a string.
As @Linus rightly suggested please convert the numeric value to character and try the below code
data have;
date="20090629";
new_date=input(date,yymmdd8.);
format new_date date9.;
run;
Thanks,
Jagadish
I think you are confusing Mediaeval by treating the date as a constant, not as a column
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.