Hello all,
I was running a program on a fairly large data set when the log threw up the following error:
NOTE: Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line): (Column).
2275580 at 16:92 113779 at 16:120 2275580 at 16:207 113779 at 16:235
NOTE: There were 113779 observations read from the data set IN1.XXXXXX.
Here is the program copied below.
LIBNAME IN1 'C:\DATA\IN';
LIBNAME OUT1 'C:\DATA\OUT';
%Let DS_ = XXXXXX;
%Let nv_ = 20;
%macro get_cmscore(
var1_ =CM_VAR1,
var2_ =CM_VAR2,
var3_ =CM_VAR3,
var4_ =CM_VAR4,
var5_ =CM_VAR5,
var6_=CM_VAR6,
var7_ =CM_VAR7,
var8_ =CM_VAR8,
var9_ =CM_VAR9,
var10_ =CM_VAR10,
var11_ =CM_VAR11,
var12_ =CM_VAR12,
var13_ =CM_VAR13,
var14_ =CM_VAR14,
var15_ =CM_VAR15,
var16_ =CM_VAR16,
var17_ =CM_VAR17,
var18_ =CM_VAR18,
var19_ =CM_VAR19,
var20_ =CM_VAR20,
rscore_=readmit_score,
mscore_=mortal_score
);
/***********************************************************/
/* Readmission Weights for calculating scores */
/***********************************************************/
rwVAR1 = 6 ;
rwVAR2 = 9 ;
rwVAR3 = 4 ;
rwVAR4 = 3 ;
rwVAR5 = 13 ;
rwVAR6 = 8 ;
rwVAR7 = 7 ;
rwVAR8 = 4 ;
rwVAR9 = 6 ;
rwVAR10 = 9 ;
rwVAR11 = 14 ;
rwVAR12 = -1 ;
rwVAR13 = 0 ;
rwVAR14 = 10 ;
rwVAR15 = 16 ;
rwVAR16 = 8 ;
rwVAR17 = 21 ;
rwVAR18 = 7 ;
rwVAR19 = -3 ;
rwVAR20 = 6 ;
/***********************************************************/
/* Mortality Weights for calculating scores */
/***********************************************************/
mwVAR1 = 6 ;
mwVAR2 = 9 ;
mwVAR3 = 4 ;
mwVAR4 = 3 ;
mwVAR5 = 13 ;
mwVAR6 = 8 ;
mwVAR7 = 7 ;
mwVAR8 = 4 ;
mwVAR9 = 6 ;
mwVAR10 = 9 ;
mwVAR11 = 14 ;
mwVAR12 = -1 ;
mwVAR13 = 0 ;
mwVAR14 = 10 ;
mwVAR15 = 16 ;
mwVAR16 = 8 ;
mwVAR17 = 21 ;
mwVAR18 = 7 ;
mwVAR19 = -3 ;
mwVAR20 = 6 ;
array cmvars(&nv_) &var1_ &var2_ &var3_ &var4_ &var5_ &var6_ &var7_ &var8_ &var9_
&var10_ &var11_ &var12_ &var13_ &var14_ &var15_ &var16_ &var17_ &var18_ &var19_
&var20_
;
array rwcms(&nv_) rwVAR1 rwVAR2 rwVAR3 rwVAR4 rwVAR5 rwVAR6 rwVAR7 rwVAR8 rwVAR9
rwVAR10 rwVAR11 rwVAR12 rwVAR13 rwVAR14 rwVAR15 rwVAR16 rwVAR17 rwVAR18 rwVAR19
rwVAR20
;
array mwcms(&nv_) mwVAR1 mwVAR2 mwVAR3 mwVAR4 mwVAR5 mwVAR6 mwVAR7 mwVAR8 mwVAR9
mwVAR10 mwVAR11 mwVAR12 mwVAR13 mwVAR14 mwVAR15 mwVAR16 mwVAR17 mwVAR18 mwVAR19
mwVAR20
;
array ocms(&nv_) oVAR1 oVAR2 oVAR3 oVAR4 oVAR5 oVAR6 oVAR7 oVAR8 oVAR9
oVAR10 oVAR11 oVAR12 oVAR13 oVAR14 oVAR15 oVAR16 oVAR17 oVAR18 oVAR19
oVAR20
;
*****Calculate readmit score;
do i = 1 to &nv_;
ocms[i]=cmvars[i]*rwcms[i];
end;
&rscore_ = sum(of ocms[*]);
*****Calculate mortality score;
do i = 1 to &nv_;
ocms[i]=cmvars[i]*mwcms[i];
end;
&mscore_ = sum(of ocms[*]);
***drop all intermediate variables;
drop rw: mw: o: i;
%mend get_cmscore;
DATA OUT1.ANALYSIS;
SET IN1.&DS_ ;
%get_cmscore;
***two output score names are readmit_score and mortal_score;
RUN;
Based on the error message, it is missing values for all the observations (113779) used in the operation. The data file has 20 variables named as var1, var2 etc with a numerical value for each variable. I have rechecked the data file and there are no issues there. I get the feeling the error is in the initial bit of this program where the value from data file has to be assigned i.e. var1_ = CM_VAR1 etc. I don't have much experience with using macros and this was a publicly available program I am trying to run. I am on SAS 9.4. Any help would be much appreciated.
Thanks!
You have this in your call to the macro:
var1_ =CM_VAR1,
var2_ =CM_VAR2,
var3_ =CM_VAR3,
var4_ =CM_VAR4,
var5_ =CM_VAR5,
var6_=CM_VAR6,
var7_ =CM_VAR7,
var8_ =CM_VAR8,
var9_ =CM_VAR9,
var10_ =CM_VAR10,
var11_ =CM_VAR11,
var12_ =CM_VAR12,
var13_ =CM_VAR13,
var14_ =CM_VAR14,
var15_ =CM_VAR15,
var16_ =CM_VAR16,
var17_ =CM_VAR17,
var18_ =CM_VAR18,
var19_ =CM_VAR19,
var20_ =CM_VAR20,
To get the proper variable names in place, you would need to get rid of the CM_:
var1_ =VAR1,
var2_ =VAR2,
var3_ =VAR3,
var4_ =VAR4,
var5_ =VAR5,
var6_=VAR6,
var7_ =VAR7,
var8_ =VAR8,
var9_ =VAR9,
var10_ =VAR10,
var11_ =VAR11,
var12_ =VAR12,
var13_ =VAR13,
var14_ =VAR14,
var15_ =VAR15,
var16_ =VAR16,
var17_ =VAR17,
var18_ =VAR18,
var19_ =VAR19,
var20_ =VAR20,
That would use the existing variables VAR1, VAR2, etc.
Do you have any missing values in these variables:
CM_VAR1, CM_VAR2, ... CM_VAR19, CM_VAR20
Missing values in those variables would create the problem you are encountering.
Thank you for your response!
The data file has variables VAR1, VAR2, ... VAR20 with either 0 or 1 as values for each of the 113779 observations. The data file itself doesn't have the variables CM_VAR1, CM_VAR2... etc. I am trying to assign those respective values to CM_VAR1, CM_VAR2 and so on. So it definitely seems like the error is because the values for CM_VAR1, CM_VAR2.. etc is missing. I am messing up somewhere in the process of assigning those values for VAR1 to CM_VAR1 etc.
You have this in your call to the macro:
var1_ =CM_VAR1,
var2_ =CM_VAR2,
var3_ =CM_VAR3,
var4_ =CM_VAR4,
var5_ =CM_VAR5,
var6_=CM_VAR6,
var7_ =CM_VAR7,
var8_ =CM_VAR8,
var9_ =CM_VAR9,
var10_ =CM_VAR10,
var11_ =CM_VAR11,
var12_ =CM_VAR12,
var13_ =CM_VAR13,
var14_ =CM_VAR14,
var15_ =CM_VAR15,
var16_ =CM_VAR16,
var17_ =CM_VAR17,
var18_ =CM_VAR18,
var19_ =CM_VAR19,
var20_ =CM_VAR20,
To get the proper variable names in place, you would need to get rid of the CM_:
var1_ =VAR1,
var2_ =VAR2,
var3_ =VAR3,
var4_ =VAR4,
var5_ =VAR5,
var6_=VAR6,
var7_ =VAR7,
var8_ =VAR8,
var9_ =VAR9,
var10_ =VAR10,
var11_ =VAR11,
var12_ =VAR12,
var13_ =VAR13,
var14_ =VAR14,
var15_ =VAR15,
var16_ =VAR16,
var17_ =VAR17,
var18_ =VAR18,
var19_ =VAR19,
var20_ =VAR20,
That would use the existing variables VAR1, VAR2, etc.
That worked! Something so obvious had me struggling for a couple of days. Thank you very much!
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.