- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I'm trying to do an interaction assessment for a dataset I have using dummy variables coded as different smoking statuses and a lifestyle score I have been using. However, when I try to multiply these together to create a variable to use in the analysis, no values are created. Both variables are numerical with the score ranging from 5-25 and the dummy variables being coded as 0/1. Code posted below:
ecl_nonsmoke = ecl2_score*dummy_nosmoke;
ecl_cursmoke = ecl2_score*dummy_cursmoke;
ecl_forsmoke = ecl2_score*dummy_forsmoke;
The proc freq I run afterwards shows that all values for the newly created variables are missing, even though all the observations in the dataset have values for the score and the dummy variables used in the calculation. Any ideas why this could be happening? Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Since we can't look in your data set, we can't tell why you are getting missing values. However, you can look at the data set, and so you should look in the data set, it will likely be obvious. Also, you should look to see if there is a warning in the log about missing values being created.
In addition, if you are working with PROC GLM, you do not need to (and should not) create your own dummy variables. PROC GLM creates the dummy variables for you behind the scenes, so you don't have to go through the effort of creating the dummy variables yourself (and possibly getting it wrong).
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@Corinthian94 wrote:
Hi all,
I'm trying to do an interaction assessment for a dataset I have using dummy variables coded as different smoking statuses and a lifestyle score I have been using. However, when I try to multiply these together to create a variable to use in the analysis, no values are created. Both variables are numerical with the score ranging from 5-25 and the dummy variables being coded as 0/1. Code posted below:
ecl_nonsmoke = ecl2_score*dummy_nosmoke;
ecl_cursmoke = ecl2_score*dummy_cursmoke;
ecl_forsmoke = ecl2_score*dummy_forsmoke;
The proc freq I run afterwards shows that all values for the newly created variables are missing, even though all the observations in the dataset have values for the score and the dummy variables used in the calculation. Any ideas why this could be happening? Thanks!
Show the log from running the code. Include the code for the entire data set and all notes.
Some Possible causes in no particular likelihood order: misspelling one or more variable names which would 1) create a variable with missing values and 2) use missing values in the calculation; using a variable before you define it; looking at the wrong data set; other assignment statements for the same variables; conditional assignment statements where the condition is never true (or always true) so the assignment never executes.