I have one column having values like 20201022, 20200123, 20220410 I have tried almost all informats to read the value. Can anyone please suggest the informat to read these values? I am expecting to read it as date and output value in the format of date9.
Thanks
Kajal
You don't say if these values are numeric or character according to PROC CONTENTS.
If character, use informat YYMMDD8.
If numeric, they have to be converted to character first.
You don't say if these values are numeric or character according to PROC CONTENTS.
If character, use informat YYMMDD8.
If numeric, they have to be converted to character first.
Thank you everyone. It worked fine after converting the type.
Did you try adding the colon (:) modifier:
data test;
format d1 d2 d3 date9.;
input d1 :yymmdd8. d2 :yymmdd8. d3 :yymmdd8.;
datalines;
20201022 20200123 20220410
;
run;
Code and/or log.
Please don't make us guess what you attempted and failed.
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: