I can't seem to figure out the problem w/ the syntax below. I get missing values for all variables included in the IF-THEN-DO. I also get missing values for variables AFTER the END statement, including bline_surv_fcau, which is simply an assigned value (i.e., bline_surv_fcauc = 0.9665;)
DATA work.test;
SET nhanes.data_2009_2018_go (OBS=5);
where age_yrs ne .;
where same and race_all in (3,4);
where same and gender=2;
where same and htn_meds=1;
where same and smk_status=1;
where same and ever_told_dm2=1;
putlog "NOTE: START DATA STEP ITERATION";
putlog
race_all=
gender=
htn_meds=
smk_status=
ever_told_dm2=
age_yrs=
cauc_f_age=
cauc_f_age_sq=
cauc_f_tchol=
cauc_f_age_x_tchol=
cauc_f_hdl=
cauc_f_sbp_tx=
cauc_f_smk=
cauc_f_age_x_smk=
cauc_f_ever_told_dm2=
ind_sum_cauc_f=
mean_cauc_f=
bline_surv_fcauc=
ascvd_score_cauc_f=
;
/***********************************************************************************************************/
/* Female, Caucasian */
/***********************************************************************************************************/
/* 1. Female, Caucasian, Treated, Smoker, Diabetic */
/***************************************************/
if
race_all = 3 and
gender = 2 and
htn_meds = 1 and
smk_status = 1 and
ever_told_dm2 = 1
then do;
cauc_f_age = log(age_yrs)*(-29.799);
cauc_f_age_sq = log(age_yrs)**2;
cauc_f_tchol = log(tchol_mg)*13.540;
/* Interaction - age and total cholesterol */
cauc_f_age_x_tchol = log(age_yrs)*log(tchol_mg)*(-3.114);
cauc_f_hdl = log(hdl_mg)*(-13.578);
/* Interaction - age and HDL */
cauc_f_age_x_hdl = log(age_yrs)*log(hdl_mg)*(49.37);
/* Treated SBP */
cauc_f_sbp_tx = log(mean_sbp)*2.019;
/* Smoker */
cauc_f_smk = 1*(7.574);
/* Interaction - age and smoking */
cauc_f_age_x_smk = log(age_yrs)*cauc_f_smk*(-1.665);
/* Diabetic */
cauc_f_ever_told_dm2 = 1*(0.661);
end;
/***********************************************************************************************************/
/* Calculating final variables */
/***********************************************************************************************************/
ind_sum_cauc_f = sum(of cauc_f:);
mean_cauc_f = mean(of cauc_f:);
bline_surv_fcauc = 0.9665;
ascvd_score_cauc_f = 1 - bline_surv_fcauc**(exp(ind_sum_cauc_f - mean_cauc_f));
run;
I'm not sure it has anything to do w/ the IF-THEN-DO. I get the same result even when I replace the IF-THEN-DO w/ a simple IF-THEN (i.e., IF gender = 3 THEN test = age_yrs+10;)
FYI. The syntax is only a subset of the full syntax for the program.
-------------------------------------------------------------------------------------------------------------------------------------------------------
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 DATA work.test;
74 SET nhanes.data_2009_2018_go (OBS=5);
75
76 where age_yrs ne .;
77 where same and race_all in (3,4);
NOTE: WHERE clause has been augmented.
78 where same and gender=2;
NOTE: WHERE clause has been augmented.
79 where same and htn_meds=1;
NOTE: WHERE clause has been augmented.
80 where same and smk_status=1;
NOTE: WHERE clause has been augmented.
81 where same and ever_told_dm2=1;
NOTE: WHERE clause has been augmented.
82
83 putlog "NOTE: START DATA STEP ITERATION";
84 putlog
85 race_all=
86 gender=
87 htn_meds=
88 smk_status=
89 ever_told_dm2=
90 age_yrs=
91
92 cauc_f_age=
93 cauc_f_age_sq=
94 cauc_f_tchol=
95 cauc_f_age_x_tchol=
96 cauc_f_hdl=
97 cauc_f_sbp_tx=
98 cauc_f_smk=
99 cauc_f_age_x_smk=
100 cauc_f_ever_told_dm2=
101
102 ind_sum_cauc_f=
103 mean_cauc_f=
104 bline_surv_fcauc=
105 ascvd_score_cauc_f=
106 ;
107 /***********************************************************************************************************/
108 /* Female, Caucasian */
109 /***********************************************************************************************************/
110
111 /* 1. Female, Caucasian, Treated, Smoker, Diabetic */
112 /***************************************************/
113 if
114 race_all = 3 and
115 gender = 2 and
116 htn_meds = 1 and
117 smk_status = 1 and
118 ever_told_dm2 = 1
119
120 then do;
121 cauc_f_age = log(age_yrs)*(-29.799);
122 cauc_f_age_sq = log(age_yrs)**2;
123 cauc_f_tchol = log(tchol_mg)*13.540;
124
125 /* Interaction - age and total cholesterol */
126 cauc_f_age_x_tchol = log(age_yrs)*log(tchol_mg)*(-3.114);
127
128 cauc_f_hdl = log(hdl_mg)*(-13.578);
129
130 /* Interaction - age and HDL */
131 cauc_f_age_x_hdl = log(age_yrs)*log(hdl_mg)*(49.37);
132
133 /* Treated SBP */
134 cauc_f_sbp_tx = log(mean_sbp)*2.019;
135
136 /* Smoker */
137 cauc_f_smk = 1*(7.574);
138
139 /* Interaction - age and smoking */
140 cauc_f_age_x_smk = log(age_yrs)*cauc_f_smk*(-1.665);
141
142 /* Diabetic */
143 cauc_f_ever_told_dm2 = 1*(0.661);
144
145 end;
146
147 /***********************************************************************************************************/
148 /* Calculating final variables */
149 /***********************************************************************************************************/
150
151 ind_sum_cauc_f = sum(of cauc_f:);
152 mean_cauc_f = mean(of cauc_f:);
153
154 bline_surv_fcauc = 0.9665;
155
156 ascvd_score_cauc_f = 1 - bline_surv_fcauc**(exp(ind_sum_cauc_f - mean_cauc_f));
157
158 run;
NOTE: START DATA STEP ITERATION
race_all=3 gender=2 htn_meds=1 smk_status=1 ever_told_dm2=1 age_yrs=40 cauc_f_age=. cauc_f_age_sq=. cauc_f_tchol=.
cauc_f_age_x_tchol=. cauc_f_hdl=. cauc_f_sbp_tx=. cauc_f_smk=. cauc_f_age_x_smk=. cauc_f_ever_told_dm2=. ind_sum_cauc_f=.
mean_cauc_f=. bline_surv_fcauc=. ascvd_score_cauc_f=.
NOTE: START DATA STEP ITERATION
race_all=4 gender=2 htn_meds=1 smk_status=1 ever_told_dm2=1 age_yrs=45 cauc_f_age=. cauc_f_age_sq=. cauc_f_tchol=.
cauc_f_age_x_tchol=. cauc_f_hdl=. cauc_f_sbp_tx=. cauc_f_smk=. cauc_f_age_x_smk=. cauc_f_ever_told_dm2=. ind_sum_cauc_f=.
mean_cauc_f=. bline_surv_fcauc=. ascvd_score_cauc_f=.
NOTE: START DATA STEP ITERATION
race_all=3 gender=2 htn_meds=1 smk_status=1 ever_told_dm2=1 age_yrs=38 cauc_f_age=. cauc_f_age_sq=. cauc_f_tchol=.
cauc_f_age_x_tchol=. cauc_f_hdl=. cauc_f_sbp_tx=. cauc_f_smk=. cauc_f_age_x_smk=. cauc_f_ever_told_dm2=. ind_sum_cauc_f=.
mean_cauc_f=. bline_surv_fcauc=. ascvd_score_cauc_f=.
NOTE: START DATA STEP ITERATION
race_all=4 gender=2 htn_meds=1 smk_status=1 ever_told_dm2=1 age_yrs=56 cauc_f_age=. cauc_f_age_sq=. cauc_f_tchol=.
cauc_f_age_x_tchol=. cauc_f_hdl=. cauc_f_sbp_tx=. cauc_f_smk=. cauc_f_age_x_smk=. cauc_f_ever_told_dm2=. ind_sum_cauc_f=.
mean_cauc_f=. bline_surv_fcauc=. ascvd_score_cauc_f=.
NOTE: START DATA STEP ITERATION
race_all=3 gender=2 htn_meds=1 smk_status=1 ever_told_dm2=1 age_yrs=45 cauc_f_age=. cauc_f_age_sq=. cauc_f_tchol=.
cauc_f_age_x_tchol=. cauc_f_hdl=. cauc_f_sbp_tx=. cauc_f_smk=. cauc_f_age_x_smk=. cauc_f_ever_told_dm2=. ind_sum_cauc_f=.
mean_cauc_f=. bline_surv_fcauc=. ascvd_score_cauc_f=.
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).
2 at 123:17 2 at 123:30 2 at 126:35 2 at 126:36 2 at 128:15 2 at 128:26 2 at 131:33 2 at 131:34 2 at 151:19
2 at 152:16 2 at 156:25 2 at 156:43 2 at 156:46 2 at 156:65
NOTE: There were 5 observations read from the data set NHANES.DATA_2009_2018_GO.
WHERE (age_yrs not = .) and race_all in (3, 4) and (gender=2) and (htn_meds=1) and (smk_status=1) and (ever_told_dm2=1);
NOTE: The data set WORK.TEST has 5 observations and 135 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
user cpu time 0.01 seconds
system cpu time 0.01 seconds
memory 2721.31k
OS Memory 36268.00k
Timestamp 07/11/2022 05:23:43 PM
Step Count 167 Switch Count 3
Page Faults 0
Page Reclaims 471
Page Swaps 0
Voluntary Context Switches 24
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 272
159
160 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
172
... View more