BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
david27
Quartz | Level 8

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

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

5 REPLIES 5
novinosrin
Tourmaline | Level 20

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.

Patrick
Opal | Level 21

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

novinosrin
Tourmaline | Level 20

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

Kurt_Bremser
Super User

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;
Patrick
Opal | Level 21

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

 


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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 5 replies
  • 1990 views
  • 1 like
  • 4 in conversation