DATA Step, Macro, Functions and more

Remove Note from Log.

Accepted Solution Solved
Reply
Learner
Posts: 1
Accepted Solution

Remove Note from Log.

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)Smiley SadColumn).

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.;

 


Accepted Solutions
Solution
a week ago
PROC Star
Posts: 1,570

Re: Remove Note from Log.

[ Edited ]

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.

View solution in original post


All Replies
Solution
a week ago
PROC Star
Posts: 1,570

Re: Remove Note from Log.

[ Edited ]

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.

Respected Advisor
Posts: 4,672

Re: Remove Note from Log.

Posted in reply to novinosrin

@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.

PROC Star
Posts: 1,570

Re: Remove Note from Log.

@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.

Super User
Posts: 9,883

Re: Remove Note from Log.

Posted in reply to novinosrin

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;
---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Respected Advisor
Posts: 4,672

Re: Remove Note from Log.


@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)Smiley SadColumn).

I don't want this note in log. 

 


@david27

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.;
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 93 views
  • 1 like
  • 4 in conversation