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.;

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