I have a variable that represents the answers to the following question on a survey:
Do you agree or disagree with the following statement: "I love pizza!"
1. Strongly Agree
2. Agree
3. Neither agree nor disagree
4. Disagree
5. Strongly Disagree
In my survey, no respondents selected option 3 ("Neither agree nor disagree"). However, I want to show in my tabulations, that respondents were presented with that option--even though nobody selected it.
Running tab pizza, I get:
pizza | freq | per | cum |
1. Strongly Agree | 22 | 22 | 22 |
2. Agree | 32 | 32 | 56 |
4. Disagree | 27 | 27 | 83 |
5. Strongly Disagree | 17 | 17 | 100 |
Total | 100 | 100 |
But, I would like to see (note the bolded row):
pizza | freq | per | cum |
1. Strongly Agree | 22 | 22 | 22 |
2. Agree | 32 | 34 | 56 |
3. Neither agree nor disagree | 0 | 0 | 56 |
4. Disagree | 27 | 27 | 83 |
5. Strongly Disagree | 17 | 17 | 100 |
Total | 100 | 100 |
I know that Stata can't know that it's *possible* for the variable pizza to take on value 3 but doesn't, but I'm wondering if it can tell how often the pizza variable takes on each of the values labeled by pizza_lab?
The following code creates data like mine:
Code:
clear set obs 100 generate pizza = floor(runiform(1,6)) recode pizza 3=2 label define pizza_lab 1 "Strongly Agree" 2 "Agree" 3 "Neither agree nor disagree" 4 "Disagree" 5 "Strongly Disagree" label val pizza pizza_lab numlabel, add force tab pizza
Daniel
0 Response to Showing values that exist in a value label but are not taken on by a variable in a table/tabulation?
Post a Comment