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.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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