Hi All,
i have issue regarding reading date from external file suppose i have veriable name Date in external file name test.csv, and in the date variable i have observation containing dates with verious format like below
date
========
1jan2010
112010
01012010
010110
now i wanted to read this file using single inout statement how can i do that? is there something if else logic we can try in input statement with informat considering the all valid SAS informat for date?
Please let me know how i can do that?
Thanks in Advanced,
Tushar J.
There is no informat that can correctly guess all possibilities. e.g. does 112010 represent Nov 20, 2010, Jan 1, 2010, or Nov (1), 2010? Regardless, the following may do what you want:
data have;
input date anydtdte.;
format date date9.;
cards;
1jan2010
112010
01012010
010110
;
There is no informat that can correctly guess all possibilities. e.g. does 112010 represent Nov 20, 2010, Jan 1, 2010, or Nov (1), 2010? Regardless, the following may do what you want:
data have;
input date anydtdte.;
format date date9.;
cards;
1jan2010
112010
01012010
010110
;
Thanks a lot Arthur for your Answer, i was under impression that this is something i need to work with informat. Or Proc format procedure...
i was just wondering if you explain me how above program is working step by step, like how sas compile it. cause i never heard about anydtdte. format again Thanks a lot. Your program has certainly solved my issue...
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.
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.