BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
David_Billa
Rhodochrosite | Level 12

can someone help me resolve this error? I except date value from this code. e.g. 10-09-2078

 

 

data test;
dt=input('43352',MMDDYY10.);
format dt MMDDYY10.;
run;

Log:

26         data test;
27         dt=input('43352',MMDDYY10.);
28         format dt MMDDYY10.;
29         run;

NOTE: Invalid argument to function INPUT at line 27 column 4.
dt=. _ERROR_=1 _N_=1
NOTE: Mathematical operations could not be performed at the following places. The results of the operations have been set to
      missing values

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

@David_Billa wrote:

I except date value from this code. e.g. 10-09-2078


But your input string of 

'43352'

very clearly does not match the structure of your date, which is required by the MMDDYY10. informat.

 

Simply read it as a number:

data _null_;
dt = input('43352',5.);
format dt yymmdd10.;
put dt=;
run;

Log:

 69         data _null_;
 70         dt = input('43352',5.);
 71         format dt yymmdd10.;
 72         put dt=;
 73         run;
 
 dt=2078-09-10

View solution in original post

3 REPLIES 3
PeterClemmensen
Tourmaline | Level 20

What do you expect from this code? 

David_Billa
Rhodochrosite | Level 12

I except date value from this code. e.g. 10-09-2078

Kurt_Bremser
Super User

@David_Billa wrote:

I except date value from this code. e.g. 10-09-2078


But your input string of 

'43352'

very clearly does not match the structure of your date, which is required by the MMDDYY10. informat.

 

Simply read it as a number:

data _null_;
dt = input('43352',5.);
format dt yymmdd10.;
put dt=;
run;

Log:

 69         data _null_;
 70         dt = input('43352',5.);
 71         format dt yymmdd10.;
 72         put dt=;
 73         run;
 
 dt=2078-09-10

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 3 replies
  • 978 views
  • 2 likes
  • 3 in conversation