BookmarkSubscribeRSS Feed
Ramy
Calcite | Level 5

I am trying to use the macro 

"Convert all character variables to numeric with macro CtoN". from the below link:

http://support.sas.com/kb/60/678.html

 

However, It is throwing me some error, as following:

 

WARNING: Apparent symbolic reference NLEV not resolved.
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand
is required. The condition was: &nlev
ERROR: The %TO value of the %DO I loop is invalid.
ERROR: The macro CTON will stop executing.

 

Any idea, how could I resolve this problem?

4 REPLIES 4
Ramy
Calcite | Level 5

I am trying to use the macro 

"Convert all character variables to numeric with macro CtoN". from the below link:

http://support.sas.com/kb/60/678.html

 

However, It is throwing me some error, as following:

 

WARNING: Apparent symbolic reference NLEV not resolved.
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand
is required. The condition was: &nlev
ERROR: The %TO value of the %DO I loop is invalid.
ERROR: The macro CTON will stop executing.

 

Any idea, how could I resolve this problem?

ballardw
Super User

Please do not post identical questions in different sections of this forum. If the topic needs to be in a different area we will often move it.

 

Multiple threads mean that you may need to answer the same questions about your data, code and log multiple times. Plus other users searching for a similar topic may not find the thread with the final solution as easily.

ballardw
Super User

Provide example of the data attempted to convert.

 

When having issues with macros generally you should set the options to display more details in the log.

Before running the macro add this line:

 

options mprint symbolgen;

which will show the resolved code generated by the macro (which all that macros actually do, create code) and the building of the macro variables used.

The error messages will appear in context better.

Use: options nomprint nosymbolgen; to turn of the added macro resolution.

 

The cause is almost certainly related to either your data or the options you provided when calling the macro.

You should provide the actual macro call you used as well.

 

 

SAS Innovate 2025: Call for Content

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!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1507 views
  • 3 likes
  • 3 in conversation