BookmarkSubscribeRSS Feed
KAZ
Obsidian | Level 7 KAZ
Obsidian | Level 7

I am attempting to get rid of a NOTE in the log file. (v9.4, Windows)

 

I run the following code:

 

data _temp;	
	a=1; output; 
run;

data _temp2;	
	set _temp;
	b = input(a, best12.);
run;

 

In the log, there is this NOTE:

NOTE: Numeric values have been converted to character values at the places given by:

 

Both variables a and b are numeric, and best12. is numeric informat.  Why is the input function converting numeric values to character values?

 

Is there another function I should use to get rid of the NOTE in the log?

6 REPLIES 6
Kurt_Bremser
Super User

Because input() is designed to input from strings, the numeric value in a must first be converted to character, so it can be read with the best12. informat.

SuryaKiran
Meteorite | Level 14

INPUT() function is used to convert character to numeric. In your example INPUT(a,best12.) --> Here 'a' must be given character values. Since you gave numeric value it converted to character and again ti numeric.

Thanks,
Suryakiran
Reeza
Super User

What are you trying to do?

 

 

KAZ
Obsidian | Level 7 KAZ
Obsidian | Level 7

I am trying to use informats for data validation.

 

For example, the external data is expected to have three values 0, 1, and 99 to indicate unknown.  I want to return a variable with just 0 and 1, convert the 99 to missing and throw an error when other values are encountered.

 

 

data _externalData;	
	a=1; output; 
	a=0; output;
	a=77; output;
	a=99; output;
run;

proc format;
	invalue test	
		0-1 	= _same_
		99	= . 
		other 	= _error_
	;
run;

data _myData;	
	set _externalData;
	b = input(a, test.);
run;

The results are what I desire, I just want to get rid of the (seemingly) unnecessary NOTE in the log.  Should I be using another function besides input?

SuryaKiran
Meteorite | Level 14

data _externalData;

a=1; output;

a=0; output;

a=77; output;

a=99; output;

run;

proc format;

value tet

0 = 0

1 = 1

99 = .

other ="_error_"

;

run;

data _myData;

set _externalData;

b = put(a, test.);

run;

Thanks,
Suryakiran

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 6 replies
  • 1929 views
  • 0 likes
  • 4 in conversation