BookmarkSubscribeRSS Feed
malikah_sph
Calcite | Level 5

I keep receiving the following error:

 

NOTE: Invalid numeric data, 'Akron General Medical Center' , at line 1332 column 19.
NOTE: Invalid numeric data, 'Albert Einstein Health Network' , at line 1333 column 19.
NOTE: Invalid numeric data, 'Anchorage Radiation Therapy Center' , at line 1334 column 19.
NOTE: Invalid numeric data, 'Augusta Health Cancer Center' , at line 1335 column 19.
NOTE: Invalid numeric data, 'Aultman Hospital' , at line 1336 column 19.
NOTE: Invalid numeric data, 'Berkshire Medical Center' , at line 1337 column 19.
NOTE: Invalid numeric data, 'Canton Mercy Medical Center' , at line 1338 column 19.
NOTE: Invalid numeric data, 'Coborn Cancer Center (St. Cloud Hospital)' , at line 1339 column
19.
NOTE: Invalid numeric data, 'Essentia Institute of Rural Health' , at line 1340 column 19.
NOTE: Invalid numeric data, 'Greater Baltimore Medical Center' , at line 1341 column 19.
NOTE: Invalid numeric data, 'Hennepin County Medical Center' , at line 1342 column 19.
NOTE: Invalid numeric data, 'Joliet Oncology Hematology Associates' , at line 1343 column 19.
NOTE: Invalid numeric data, 'Legacy Health' , at line 1344 column 19.
NOTE: Invalid numeric data, 'Memorial Medical Center' , at line 1345 column 19.
NOTE: Invalid numeric data, 'New England Cancer Specialists' , at line 1346 column 19.
NOTE: Invalid numeric data, 'NorthShore' , at line 1347 column 19.
NOTE: Invalid numeric data, 'Oregon Health & Sciences University' , at line 1348 column 19.
NOTE: Invalid numeric data, 'Park Ridge Health' , at line 1349 column 19.
NOTE: Invalid numeric data, 'Parkview Hospital' , at line 1350 column 19.
NOTE: Invalid numeric data, 'ProMedica Research Institute' , at line 1351 column 19.
NOTE: Invalid numeric data, 'SCLHS (Saint Joseph Hospital)' , at line 1352 column 19.
NOTE: Invalid numeric data, 'Sanford Clinic North' , at line 1353 column 19.
NOTE: Invalid numeric data, 'South Georgia Medical Center' , at line 1354 column 19.
NOTE: Invalid numeric data, 'Spartanburg Regional Health (Gibbs Cancer Ctr)' , at line 1355
column 19.
NOTE: Invalid numeric data, 'St. Luke's Hospital of Kansas City' , at line 1356 column 19.
NOTE: Invalid numeric data, 'St. Mary Medical Center' , at line 1357 column 19.
NOTE: Invalid numeric data, 'UnityPoint Health' , at line 1358 column 19.
NOTE: Invalid numeric data, 'Wenatchee Valley (Confluence)' , at line 1359 column 19.
NOTE: Invalid numeric data, 'Wheaton Franciscan Healthcare' , at line 1360 column 19." 

 

I am putting in this code:

 

data tmp1;
set redcap;

instn=.;
if institution eq "Akron General Medical Center" then instn='1';
if institution eq "Albert Einstein Health Network" then instn='2';
if institution eq "Anchorage Radiation Therapy Center" then instn='3';
if institution eq "Augusta Health Cancer Center" then instn='4';
if institution eq "Aultman Hospital" then instn='5';
if institution eq "Berkshire Medical Center" then instn='6';
if institution eq "Canton Mercy Medical Center" then instn='7';
if institution eq "Coborn Cancer Center (St. Cloud Hospital)" then instn='8';
if institution eq "Essentia Institute of Rural Health" then instn='9';
if institution eq "Greater Baltimore Medical Center" then instn='10';
if institution eq "Hennepin County Medical Center" then instn='11';
if institution eq "Joliet Oncology Hematology Associates" then instn='12';
if institution eq "Legacy Health" then instn='13';
if institution eq "Memorial Medical Center" then instn='14';
if institution eq "New England Cancer Specialists" then instn='15';
if institution eq "NorthShore" then instn='16';
if institution eq "Oregon Health & Sciences University" then instn='17';
if institution eq "Park Ridge Health" then instn='18';
if institution eq "Parkview Hospital" then instn='19';
if institution eq "ProMedica Research Institute" then instn='20';
if institution eq "SCLHS (Saint Joseph Hospital)" then instn='21';
if institution eq "Sanford Clinic North" then instn='22';
if institution eq "South Georgia Medical Center" then instn='23';
if institution eq "Spartanburg Regional Health (Gibbs Cancer Ctr)" then instn='24';
if institution eq "St. Luke's Hospital of Kansas City" then instn='25';
if institution eq "St. Mary Medical Center" then instn='26';
if institution eq "UnityPoint Health" then instn='27';
if institution eq "Wenatchee Valley (Confluence)" then instn='28';
if institution eq "Wheaton Franciscan Healthcare" then instn='29';
label instn='Institution Name';
run;

 

Can anyone provide any recommendations on how to fix it?

4 REPLIES 4
LinusH
Tourmaline | Level 20
It seems that redcap.institution is numeric.

Other than that I just want to suggest not to write programs like this, at least if this is to be reused.
Kepp this mapping logic in a separate look up table instead.
Data never sleeps
Astounding
PROC Star

As Linus mentioned, these results indicate that your existing variable INSTITUTION is already numeric.  The good news, though, is that you don't need to create any sort of a translation table.  That part is already done, given that you are seeing values such as 'Akron General Medical Center' for INSTITUTION.  This means that there is a format being applied to this variable, and you don't need to create INST.  You can just use the actual value of INSTITUTION.  For example, try this program:

 

proc freq data=redcap;

tables institution;

run;

 

proc freq data=redcap;

tables institution;

format institution;

run;

 

You can see the actual values, vs. the formatted values, in the output.

 

Finally note, if you do decide to create INSTN anyway, you should use leading zeroes ('01', not '1') for two reasons.  First, the current code defines INSTN as being one character long.  There won't be room to hold the two-digit values.  And second, sorting in numeric order is more difficult when a character variable contains different numbers of digits.

 

Good luck.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

I am with @LinusH here.  What I think you will find is that the variable institution is actually number, which probably has a format applied to it.  So when you look at the dataset you see the text, but really its a number underneath.  You don't say what app you are using, but if you do the code:

data test;
  set your_dataset;
  format _all_;
run;

This should remove the formats and you will see the underlying data.

 

Also, I totally agree that this ton of if statements is not a good idea, you could replace them with a select() when step, but is there a reason you need to do all these if's?  Its likely the underlying value is all you need.

FreelanceReinh
Jade | Level 19

Also, there must have been another undesirable note in your log, preceding the notes you've posted:

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

(followed by lots of line and column numbers).

 

This would refer not only to your comparisons of numeric INSTITUTION values to character strings, but also to your attempt to assign character strings such as '1' to variable INSTN, which you initialized with a numeric missing value and thus defined as numeric (unless it's a character variable contained in REDCAP). The good thing about a numeric variable INSTN is that you wouldn't run into the truncation and sorting issues @Astounding mentioned.

 

Knowing the types of your variables will help you to code appropriately so that none of all those notes will occur. As others have already mentioned, you should familiarize yourself with the important concept of SAS formats.

 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2478 views
  • 0 likes
  • 5 in conversation