Team,
Can some one please help me with this code.
It works fine but leaves a Note. Similar to this:
NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).
I don't want this note in log.
Please advise what should I change the code to, to avoid this note.
%let start_date=201803;
%let stop_date= 201805;
data _null_;
call symput('endcnt',intck('month',input(cat(&start_date,'01'),yymmdd8.), input(cat(&end_date,'01'),yymmdd8.)));
run;
%put endcnt==&endcnt.;
try call symputx
http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002295697.htm
Comparisons |
CALL SYMPUTX is similar to CALL SYMPUT except that
CALL SYMPUTX does not write a note to the SAS log when the second argument is numeric. CALL SYMPUT, however, writes a note to the log stating that numeric values were converted to character values.
try call symputx
http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002295697.htm
Comparisons |
CALL SYMPUTX is similar to CALL SYMPUT except that
CALL SYMPUTX does not write a note to the SAS log when the second argument is numeric. CALL SYMPUT, however, writes a note to the log stating that numeric values were converted to character values.
@novinosrin and @david27
I still believe using an explicit PUT statement for numeric variables is the better option as else SAS will use whatever default or previously permanently assigned format applies to the numeric variable.
@Patrick Sir, I don't disagree with a cleaner approach. But in this instance of OP's requirement, I believe call symputx should suffice well.
The fact that symputx hides the automatic conversion does not remove the dangers of such. An automatic type cast is an automatic type cast is an automatic type cast. No way around it.
So the proper approach is always to take full control of the process and use a put with a defined format. I use symputx for automatic stripping and control of the target symbol table, not to hide my sloppy programming.
%let start_date=201803;
%let stop_date=201805;
data _null_;
call symputx('endcnt',put(intck('month',input("&start_date.01",yymmdd8.),input("&stop_date.01",yymmdd8.)),5.));
run;
@david27 wrote:
Team,
Can some one please help me with this code.
It works fine but leaves a Note. Similar to this:
NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).
I don't want this note in log.
I think that's a great note and that you shouldn't be able to get rid of it other than via implementing clean code.
Below code which doesn't create such a note.
%let start_date=201803;
%let end_date= 201805;
data _null_;
endcnt=intck('month',input(cat("&start_date",'01'),yymmdd8.), input(cat("&end_date",'01'),yymmdd8.));
call symput('endcnt',put(endcnt,f10. -l));
run;
%put endcnt=&endcnt.;
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.