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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 455 views
  • 2 likes
  • 3 in conversation