Hi,
I am facing problem in combining two variables in the same dataset as those are categorical, answered in yes(code-1), no(code-0) and missing(code-99). Please help me with the command. i am writing an example here.
1. variable A1 (went to the doctor or not)
yes - 100
No- 50
missing- 5
2. Variable A2 (went to the Nurse or not)
yes- 200
No- 75
missing- 4
Now i want to add these two variables into one variable A (went to professionals), want to add all the yes, no and missing together. egen command doesn't work as this is not numerical data. if i stack, them, then i get the expected result but all other data gets deleted after stacking them. so, i cannot use the stacking command for my analysis. and if stacking is the only option please give me solution how can keep my all other data and use for my analysis. For the example i provided here, the expected result is-
variable A
yes- 300
No- 125
Missing- 9
I hope i could describe my problem clearly. Please help me with the stata command that i can use for my analysis.
-Sharmeen
I am facing problem in combining two variables in the same dataset as those are categorical, answered in yes(code-1), no(code-0) and missing(code-99). Please help me with the command. i am writing an example here.
1. variable A1 (went to the doctor or not)
yes - 100
No- 50
missing- 5
2. Variable A2 (went to the Nurse or not)
yes- 200
No- 75
missing- 4
Now i want to add these two variables into one variable A (went to professionals), want to add all the yes, no and missing together. egen command doesn't work as this is not numerical data. if i stack, them, then i get the expected result but all other data gets deleted after stacking them. so, i cannot use the stacking command for my analysis. and if stacking is the only option please give me solution how can keep my all other data and use for my analysis. For the example i provided here, the expected result is-
variable A
yes- 300
No- 125
Missing- 9
I hope i could describe my problem clearly. Please help me with the stata command that i can use for my analysis.
-Sharmeen
Comment