BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Lee_wan
Obsidian | Level 7

Hi all,

 

Why the ifn function report error when it  run as below?

 

1.png

data a;
  set sdtm.ae;
  dt=ifn(length(aestdtc)>=10,input(aestdtc,yymmdd10.),0);
run;

2.png

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

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;

View solution in original post

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

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;
Lee_wan
Obsidian | Level 7
Thanks a lot!

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1295 views
  • 0 likes
  • 2 in conversation