- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
Why the ifn function report error when it run as below?
data a;
set sdtm.ae;
dt=ifn(length(aestdtc)>=10,input(aestdtc,yymmdd10.),0);
run;
Thanks!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Just to be clear, there are no errors in your log. There are notes, which are very different. The problem here is that with the yymmdd10. informat, SAS expects the aestdtc to have 10 characters. If it does not (as in two of your posted observations), SAS issues a note.
You could use the Anydtdte. Informat to make sense of character dates with varying lengths like this
data have;
input aestdtc $10.;
datalines;
2019-01-15
2019-02
2019-02-13
;
data want;
set have;
dt=input(aestdtc,anydtdte10.);
format dt mmddyy10.;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Just to be clear, there are no errors in your log. There are notes, which are very different. The problem here is that with the yymmdd10. informat, SAS expects the aestdtc to have 10 characters. If it does not (as in two of your posted observations), SAS issues a note.
You could use the Anydtdte. Informat to make sense of character dates with varying lengths like this
data have;
input aestdtc $10.;
datalines;
2019-01-15
2019-02
2019-02-13
;
data want;
set have;
dt=input(aestdtc,anydtdte10.);
format dt mmddyy10.;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content