DATA Step, Macro, Functions and more

using INPUT function

Reply
Occasional Contributor
Posts: 7

using INPUT function

what is the result of the below statment, if the &beg_date = '20160101'

 

from_date = INPUT (&beg_date, YYMMDD8.);

 

 

Super User
Super User
Posts: 7,970

Re: using INPUT function

Posted in reply to SudheerAnkem

The result is the string:

from_date = INPUT ('20160101', YYMMDD8.);

 

Gets fed into the SAS compiler.  I assume you know what the input() function does - i.e. convert text in the given format to numeric variant?

Super User
Posts: 5,431

Re: using INPUT function

Posted in reply to SudheerAnkem

IMO these kind of questions shouldn't be asked here, since they can be answered by just testing the code.

Data never sleeps
Super User
Posts: 10,035

Re: using INPUT function

Posted in reply to SudheerAnkem
from_date = INPUTN (&beg_date, YYMMDD8.);
Super User
Posts: 10,035

Re: using INPUT function

Posted in reply to SudheerAnkem

 
 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 51         
 52         %let beg_date = '20160101';
 53         data _null_;
 54         from_date = INPUT(&beg_date, YYMMDD8.);
 55         put from_date= yymmddn8.;
 56         run;
 
 from_date=20160101
 NOTE: DATA statement used (Total process time):
       real time           0.01 seconds
       cpu time            0.02 seconds
       
 
 57         
 58         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 68         

Ask a Question
Discussion stats
  • 4 replies
  • 274 views
  • 2 likes
  • 4 in conversation