BookmarkSubscribeRSS Feed
souji
Obsidian | Level 7

Hi,  am I doing anything wrong here since Ship_data is not coming same as like (02FEB2009) in output. please correct my code

 

data work.put123;

length Order_Id 6 Customer $15 Ship_date 8;

input @1 Order_Id 5. @7 Customer $12. @20 Ship_date date9.;

format Ship_date yymmddd10.;

datalines;

 

9341    Josh Martin     02FEB2009

9874    Rachel Lords  14MAR2009

10233  Takashi Sato   07JUL2009

;

run;

 

3 REPLIES 3
ed_sas_member
Meteorite | Level 14

Hi @souji 

You just need to use the date9. Format instead of the yymmddd10. format:

format Ship_date date9.;
souji
Obsidian | Level 7

Thank you

PeterClemmensen
Tourmaline | Level 20

Simply apply the Date9 format instead

 

data work.put123;
length Order_Id 6 Customer $15 Ship_date 8;
input @1 Order_Id 5. @7 Customer $12. @20 Ship_date date9.;
format Ship_date date9.;
datalines;
9341  Josh Martin  02FEB2009
9874  Rachel Lords 14MAR2009
10233 Takashi Sato 07JUL2009
;
run;

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
  • 3 replies
  • 388 views
  • 1 like
  • 3 in conversation