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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 691 views
  • 0 likes
  • 3 in conversation