BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
PaigeMiller
Diamond | Level 26
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=.
 
cauc_f_age is set to missing despite that fact that the variable used in its calculation is NOT missing (i.e., age_yrs).
 
I assume you have highlighted this because you think this indicates a problem. This log output is printed from your PUT statements at the start of the data step, before cauc_f_age is assigned a value. So of course, cauc_f_age is always missing in your PUT statements. Later on, cauc_f_age does indeed get assigned a value for each observation and this value appears in the output data set. So you are looking in the wrong place. Or, if you repeat your PUT statements at the end of the data step, you will see that cauc_f_age is indeed assigned a value.
 
Others have pointed out the problem that tchol_mg doesn't exist, so all variables computed from it will be missing.
 
Another suggestion, if I am understanding this properly, is that you are creating variables whose variable name contains cauc_f and presumably there will be a cauc_m and others. This is a poor design for variable names and for the data set. Information, such as gender or race, that can vary from observation, should be indicated by variables which you already have, rather than in the name of the variable. Cauc_f_age should just be age, and there should be a value regardless of whether the observation is cauc and regardless of whether the observation is F. This is a much better design of a data set, and will lead to much easier programming.
--
Paige Miller
_maldini_
Barite | Level 11

 

@PaigeMiller I didn't realize that the location of PUT statements mattered. It makes sense, but I didn't know that. Thank you!

 

Regarding your suggestion, first, thank you for that. I appreciate any additional insight you might offer! Second, "Cauc_f_age" is not the age of caucasian females. It is the log of their age and is only used in a calculation of their 10-year risk of a heart attack. 

PaigeMiller
Diamond | Level 26

@_maldini_ wrote:

 

Regarding your suggestion, first, thank you for that. I appreciate any additional insight you might offer! Second, "Cauc_f_age" is not the age of caucasian females. It is the log of their age and is only used in a calculation of their 10-year risk of a heart attack. 


You have completely missed the point. It doesn't matter what the number is, you don't put data that can change from observation to observation in variable names. The name could be age or log_age or anything else you think is appropriate, without the cauc_f.

--
Paige Miller

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 17 replies
  • 4687 views
  • 14 likes
  • 5 in conversation