Have a question regarding subpop.
I am working with a large national healthcare dataset (NHAMCS).
I created a new variable for a particular diagnosis using the following command:
gen COPDD=0
replace COPDD=1 if (DIAG1R==149121 | DIAG1R==149122 | DIAG1R==149190 | DIAG1R==149280 | DIAG1R==149600) & DIAG2R!=148100 & DIAG2R!=148210 & DIAG2R!=148242 & DIAG2R!=148290 & DIAG2R!=148500 & DIAG2R!=148600 & DIAG3R!=148100 & DIAG3R!=148210 & DIAG3R!=148242 & DIAG3R!=148290 & DIAG3R!=148500 & DIAG3R!=148600
I now want to confirm successful creation of the new variable by tabulating DIAG1R.
If I use "svy: tabulate DIAG1R if COPDD==1", the output looks correct in terms of my having successfully isolated the "DIAG1R" variable values I was concerned with:
svy: tabulate DIAG1R if COPDD==1
(running tabulate on estimation sample)
Number of strata = 32 Number of obs = 693
Number of PSUs = 267 Population size = 2,905,236
Design df = 235
----------------------
Diagnosis |
#1 - |
numeric |
recode | proportion
----------+-----------
CB_ACUTE | .516
CB_W_AB | .04
CB_NOS | .0124
EMPHYSEM | .0247
COPD | .4069
Total | 1
----------------------
Key: proportion = cell proportion
BUT, if I use "svy, subpop(if COPDD==1): tabulate DIAG1R" stata tells me there are "too many values".
what am I doing wrong?
Thanks for any help
I am working with a large national healthcare dataset (NHAMCS).
I created a new variable for a particular diagnosis using the following command:
gen COPDD=0
replace COPDD=1 if (DIAG1R==149121 | DIAG1R==149122 | DIAG1R==149190 | DIAG1R==149280 | DIAG1R==149600) & DIAG2R!=148100 & DIAG2R!=148210 & DIAG2R!=148242 & DIAG2R!=148290 & DIAG2R!=148500 & DIAG2R!=148600 & DIAG3R!=148100 & DIAG3R!=148210 & DIAG3R!=148242 & DIAG3R!=148290 & DIAG3R!=148500 & DIAG3R!=148600
I now want to confirm successful creation of the new variable by tabulating DIAG1R.
If I use "svy: tabulate DIAG1R if COPDD==1", the output looks correct in terms of my having successfully isolated the "DIAG1R" variable values I was concerned with:
svy: tabulate DIAG1R if COPDD==1
(running tabulate on estimation sample)
Number of strata = 32 Number of obs = 693
Number of PSUs = 267 Population size = 2,905,236
Design df = 235
----------------------
Diagnosis |
#1 - |
numeric |
recode | proportion
----------+-----------
CB_ACUTE | .516
CB_W_AB | .04
CB_NOS | .0124
EMPHYSEM | .0247
COPD | .4069
Total | 1
----------------------
Key: proportion = cell proportion
BUT, if I use "svy, subpop(if COPDD==1): tabulate DIAG1R" stata tells me there are "too many values".
what am I doing wrong?
Thanks for any help
Comment