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

I am using SAS 9.4 and keep getting the following note in my SAS log at various locations

 

NOTE: Character values have been converted to numeric values at the places given by:
(Line):(Column).
22:18

here is an example of code which causes the problem. 

 

 



DATA SET1; /*Format data, create new variables*/
SET DAD_RawFile;
Length MRD_ICD9_3digit $3 SEX_1 $7;
TITLE 'SET 1';

/*Create a CAUSE_ICD9_3digit variable to code for specific causes*/
IF code_indicator = 'ICD9' THEN MRD_ICD9_3digit = substr(MRD,1,3); /*Text variable containing 1st THREE characters of the ‘MRD’ variable*/
ELSE MRD_ICD9_3digit = '';

/*Recode missing rescode as '00000'*/
IF rescode = '' OR rescode = . THEN rescode = 00000;

/*Standardize sex variable*/
IF sex =: 'M' THEN SEX_1 = 'Male';
ELSE IF sex =: 'F' THEN SEX_1 = 'Female';
ELSE IF sex= '' THEN SEX_1 = 'Unknown';
ELSE SEX_1 = 'Error';
RUN;

and in the results viewer i get the following note

11
12   DATA SET1; /*Format data, create new variables*/
13       SET DAD_RawFile;
14       Length MRD_ICD9_3digit $3 SEX_1 $7;
15       TITLE 'SET 1';
16
17   /*Create a CAUSE_ICD9_3digit variable to code for specific causes*/
18       IF code_indicator = 'ICD9' THEN MRD_ICD9_3digit = substr(MRD,1,3); /*Text variable
18 ! containing 1st THREE characters of  the ‘MRD’ variable*/
19           ELSE MRD_ICD9_3digit = '';
20
21   /*Recode missing rescode as '00000'*/
22       IF rescode = '' OR rescode = . THEN rescode = 00000;
23
24   /*Standardize sex variable*/
25       IF sex =: 'M' THEN SEX_1 = 'Male';
26       ELSE IF sex =: 'F' THEN SEX_1 = 'Female';
27       ELSE IF sex= '' THEN SEX_1 = 'Unknown';
28       ELSE SEX_1 = 'Error';
29   RUN;

NOTE: Character values have been converted to numeric values at the places given by:
      (Line):(Column).
      22:18


I was thinking that when i created the new variable as character and defined its length (i.e.

Length MRD_ICD9_3digit $3 SEX_1 $7;

 Then it would end up as character but it seems as though SAS is converting it to numeric and i'm not sure why or how much it is impacting my data set. I'm also not sure how to fix it. 

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

You are getting this message because of RESCODE.  You need to refer to it properly.  If it is character, you could code:

 

if rescode = ' ' then rescode = '00000';

 

If it is numeric, the code would be:

 

if rescode = . then rescode = 0;

 

But this beginning is definitely going to force a conversion:

 

if rescode = ' ' or rescode = . then .........

View solution in original post

2 REPLIES 2
Astounding
PROC Star

You are getting this message because of RESCODE.  You need to refer to it properly.  If it is character, you could code:

 

if rescode = ' ' then rescode = '00000';

 

If it is numeric, the code would be:

 

if rescode = . then rescode = 0;

 

But this beginning is definitely going to force a conversion:

 

if rescode = ' ' or rescode = . then .........

karora1
Fluorite | Level 6

Thank you for the reply. I was able to correct the problem in the code i shared as well as go through the rest of the code in that file and correct similar errors. I have now run all of the code and it is error free. 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2 replies
  • 17511 views
  • 3 likes
  • 2 in conversation