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...
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: