BookmarkSubscribeRSS Feed
R_Win
Calcite | Level 5
Hi i want to read these observations in the same variable dt as they are in ddmmyy10. and date11. and if date is like 0970 and 0001 it should be in to 1900

data l3;
input dt ;
cards;
01/03/0970
01/01/0001
01/01/2003
12-sep-2011

run;


output:
01/03/1900
01/01/1901
01/01/2003
12/09/2011
3 REPLIES 3
DBailey
Lapis Lazuli | Level 10
try

option datestyle=dmy;

data l3;
input dt anydtdte21.;
cards;
01/01/2003
12-sep-2011
run;
sss
Fluorite | Level 6 sss
Fluorite | Level 6
HI try this one;


data la;
input dt anydtdte21.;
format dt ddmmyy10.;
cards;
01/01/2003
12-sep-2011
run;
SPR
Quartz | Level 8 SPR
Quartz | Level 8
Hello R_Win,

Is this what you need?
[pre]
data i;
input d $20.;
if SUBSTR(d,7) = "0970" then dt=INPUT(SUBSTR(d,1,6)||'1900',anydtdte21.);
else if SUBSTR(d,7) = "0001" then dt=INPUT(SUBSTR(d,1,6)||'1901',anydtdte21.);
else dt=INPUT(d,anydtdte21.);
format dt ddmmyy10.;
datalines;
01/03/0970
01/01/0001
01/01/2003
12-sep-2011
run;
[/pre]
Sincerely,
SPR

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 721 views
  • 0 likes
  • 4 in conversation