BookmarkSubscribeRSS Feed
SASPhile
Quartz | Level 8
The date format is not consistent across the observations.
the first few rows has 09/18/2009 format and after which some rows will have
Sep-09 format.
How to make the date field consistent like mmddyy10. format?
5 REPLIES 5
Flip
Fluorite | Level 6
Is this a SASDATE variable or text. It must be text for this to happen. Give us some information on what type of data you have.
SASPhile
Quartz | Level 8
text.
This is how i get my date field:

SHIP_DATE
09/22/2009
09/18/2009
09/22/2009
09/18/2009
Sep-09
Sep-09
CurtisMack
Fluorite | Level 6
This will do it.
------------------------------------
data test;
format SHIP_DATE mmddyy10.;
input SHIP_DATE : anydtDTE10.;
cards;
09/22/2009
09/18/2009
09/22/2009
09/18/2009
Sep-09
Sep-09
;
run;
--------------------
CurtisMack
Fluorite | Level 6
If you are still working on translating those Excel spreadsheets, this is probably more what you are looking for.
------------------------------
data test;
length SHIP_DATE $10;
input SHIP_DATE;
cards;
09/22/2009
09/18/2009
09/22/2009
09/18/2009
Sep-09
Sep-09
;
run;
data test2;
set test;
format SHIP_DATE_DT mmddyy10.;
SHIP_DATE_DT = input(SHIP_DATE,anydtDTE10.);
run;
-----------------------------
Flip
Fluorite | Level 6
input dateinfo anydtdte21.;

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
  • 5 replies
  • 714 views
  • 0 likes
  • 3 in conversation