BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
kajal_30
Quartz | Level 8

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

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
kajal_30
Quartz | Level 8

Thank you everyone. It worked fine after converting the type.

JOL
SAS Employee JOL
SAS Employee

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;

 

 

 

ballardw
Super User

Code and/or log.

Please don't make us guess what you attempted and failed.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1038 views
  • 1 like
  • 4 in conversation