Hi,
Im trying to resolve a value of start_date which has a value of date value as numeric (21032). im trying to resolve to see what date value it has , when i run %put end_date: %sysfunc(inputn(&end_date.,worddate18.),date9.); it in sas eg it is resolving to something like 28jun2017, but when i execute same code in batch mode it is resolving to null(.) see below. any idea ?
SYMBOLGEN: Macro variable START_DATE resolves to 21032
SYMBOLGEN: Macro variable END_DATE resolves to 21032
537
538 %put &start_date &end_date;
21032 21032
539
540 %put start_date: %sysfunc(inputn(&start_date.,worddate18.),date9.);
SYMBOLGEN: Macro variable START_DATE resolves to 21032
WARNING: Argument 2 to function INPUTN referenced by the %SYSFUNC or %QSYSFUNC macro function is out of range.
NOTE: Mathematical operations could not be performed during %SYSFUNC function execution. The result of the operations have been set
to a missing value.
start_date: .
541 %put end_date: %sysfunc(inputn(&end_date.,worddate18.),date9.);
SYMBOLGEN: Macro variable END_DATE resolves to 21032
WARNING: Argument 2 to function INPUTN referenced by the %SYSFUNC or %QSYSFUNC macro function is out of range.
NOTE: Mathematical operations could not be performed during %SYSFUNC function execution. The result of the operations have been set
to a missing value.
end_date: .
Yep, Thats what my understanding is too and that also raised my eyebrows failing to comprehend OP's put statements-
%let start_date=20133;/*i am testing*/
%let end_date=20133 /*i am testing*/
/*OP's put statement*/
%put start_date: %sysfunc(inputn(&start_date.,worddate18.),date9.);
%put end_date: %sysfunc(inputn(&end_date.,worddate18.),date9.);
/*my log*/
WARNING: Argument 2 to function INPUTN referenced by the %SYSFUNC or %QSYSFUNC macro function is
out of range.
NOTE: Mathematical operations could not be performed during %SYSFUNC function execution. The
result of the operations have been set to a missing value.
start_date: .
4 %put end_date: %sysfunc(inputn(&end_date.,worddate18.),date9.);
WARNING: Argument 2 to function INPUTN referenced by the %SYSFUNC or %QSYSFUNC macro function is
out of range.
NOTE: Mathematical operations could not be performed during %SYSFUNC function execution. The
result of the operations have been set to a missing value.
end_date: .
I think the correct put statement should be -
%put %sysfunc(putn(&start_date.,worddate18.));
%put %sysfunc(putn(&end_date.,worddate18.));
What does the code submitted via batch look like?
I think running in batch, is the equivalent of running in a 'clean session' so nothing you previously created is accessible if it's not store permanently somewhere, and macro variables are not kept across sessions.
reeza,
same code below
PROC SQL INOBS=10;
CREATE TABLE m1 AS
SELECT A.*,input(substr(ver_desc,18,10),mmddyy10.) as date1 FROM table1 A
WHERE VER=0;
QUIT;
proc sql;
select date1 into :start_date from m1 ;
select date1 into :end_date from m1 ;
quit;
%put &start_date &end_date;
%put start_date: %sysfunc(inputn(&start_date.,worddate18.),date9.);
%put end_date: %sysfunc(inputn(&end_date.,worddate18.),date9.);
Hi, is inputn necessary to read a number which is not a formtted date value/character value? Or am i missing something
%put %sysfunc(putn(21033,date9.));
I am wondering how can a worddate18. informat be used to read 21033
INFORMAT represents the data the format is already in and you want to read it in.
FORMAT is how you want to display the information.
@novinosrin wrote:
Hi, is inputn necessary to read a number which is not a formtted date value/character value? Or am i missing something
%put %sysfunc(putn(21033,date9.));
I am wondering how can a worddate18. informat be used to read 21033
Yep, Thats what my understanding is too and that also raised my eyebrows failing to comprehend OP's put statements-
%let start_date=20133;/*i am testing*/
%let end_date=20133 /*i am testing*/
/*OP's put statement*/
%put start_date: %sysfunc(inputn(&start_date.,worddate18.),date9.);
%put end_date: %sysfunc(inputn(&end_date.,worddate18.),date9.);
/*my log*/
WARNING: Argument 2 to function INPUTN referenced by the %SYSFUNC or %QSYSFUNC macro function is
out of range.
NOTE: Mathematical operations could not be performed during %SYSFUNC function execution. The
result of the operations have been set to a missing value.
start_date: .
4 %put end_date: %sysfunc(inputn(&end_date.,worddate18.),date9.);
WARNING: Argument 2 to function INPUTN referenced by the %SYSFUNC or %QSYSFUNC macro function is
out of range.
NOTE: Mathematical operations could not be performed during %SYSFUNC function execution. The
result of the operations have been set to a missing value.
end_date: .
I think the correct put statement should be -
%put %sysfunc(putn(&start_date.,worddate18.));
%put %sysfunc(putn(&end_date.,worddate18.));
Thank you.
but only my question is when i run below statement in sas eg it is displaying date9 something like "28jun2017" ? not sure y.
%put start_date: %sysfunc(inputn(&start_date.,worddate18.),date9.);
@Deepti44 wrote:
Thank you.
but only my question is when i run below statement in sas eg it is displaying date9 something like "28jun2017" ? not sure y.
%put start_date: %sysfunc(inputn(&start_date.,worddate18.),date9.);
Please show the value you are using for &start_date.
And I would expect that to generate an error as WORDATE. is not an informat that can be used with input
11 data junk; 12 y=input('January 1, 2017', Worddate18.); ----------- 485 NOTE 485-185: Informat WORDDATE was not found or could not be loaded. 13 run;
My guess is that when you're running in batch mode you haven't created table1 in your work directory.
Art, CEO, AnalystFinder.com
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.