So this seems very simple but very wired problem has confused me for so long, and it never happened like this before... Here it is:
I am calculating a variable called M_final = 8-(M1+M2+M3+M4+M5+M6+M7+(M8/4)
all M1 to M8 are numerical values, so I would expect M_final be a numerical value as well, also with decimal points (because M8/4), later I will need this M_final to create a character category like HighScore, LowScore
ID | M1 | M2 | M3 | M4 | M5 | M6 | M7 | M8 |
1 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 4 |
2 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 1 |
3 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 3 |
4 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 |
5 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 |
6 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 2 |
7 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 |
8 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 1 |
9 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 3 |
10 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
So my code in data step is (as easy as it is):
M_Score = 8-(M1+M2+M3+M4+M5+M6+M7+(M8/4));
but this is what SAS keeps showing me in Log:
Numeric values have been converted to character values at the places given by:
(Line):(Column).
-> it points to the line above
I am very confused why it happened and how to make it work as it should.
I've tried to use input to force the values back from character to numeric values, but it creates another problem that all decimal points are lost....
Thank you!
Maybe M_score or M_final already exist as a character variable in your input dataset.
One of the variables in your formula is not numeric.
Run a PROC CONTENTS and check the type.
Maybe M_score or M_final already exist as a character variable in your input dataset.
Please post your full code and log.
Post the PROC CONTENTS output.
thanks @Reeza@Shmuel@Shmuel, stupid me, you guys are right. What happened is that I have different dataset from different school for calculation, some of them did have M_score/M_final in the dataset, with all missing character values. I dropped them in set step and re-create M_Score/M_final with calculation.
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.
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.