Cox Model and Recoded Variables From BR File [message #20206] |
Thu, 08 October 2020 01:41 |
shujaat.smc@gmail.com
Messages: 75 Registered: July 2020
|
Senior Member |
|
|
Dear DHS Representative,
I am working on Sub-population of neonates with Bw2500gms and above, looking for determinants of mortality among them in four provinces of Pakistan.
I recode the following variables using "Negative Coding" for dotted observations and Low birth weight babies using following commands;
****Size of child at birth****
recode m18 (4/.=-1 "NotApp&Lower") (3=1 "Average") (2=2 "LargerThanAvg") (1=3 "VeryLarge"), gen (percievedsizeofbaby)
*******When the Child First put to breats *****
recode m34 (0/201=1 "DayofBirth") (202/207=2 "Between2nd-7thDayofBirth") (208/230=3 "From8th-30thDayofBirth") (.=-1 "NotApp"), gen (breastfeedingpractice)
**** Variable Birthorder bord recoding *********
recode bord (1=1 "First") (2=2 "Second") (3=3 "Third") (4=4 "Fourth") (5/15=5 "FifthorAbove"), gen (BirthorderofNewborn)
************************************************************ *****************
I use these new variables for cox-model using command
svy linearized, subpop(subpopulationbw2) : stcox ib(last).breastfeedingpractice ib(last).BirthorderofNewborn ib(first).percievedsizeofbaby
******* My Question is on the following error message from stata 13.1 ****
🚩Note: subpop() takes on values other than 0 and 1
subpop() != 0 indicates subpopulation
(running stcox on estimation sample)
breastfeedingpractice: factor variables may not contain negative values
an error occurred when svy executed stcox 🚩r(7);
Kindly explain what mistake I am making in recoding & generating new variables and why got this error in stata.
Truely obliged and appreciate your quick responses for my questions asked earlier.
Best Regards
Dr. Hussain
|
|
|
Re: Cox Model and Recoded Variables From BR File [message #20210 is a reply to message #20206] |
Thu, 08 October 2020 07:45 |
Bridgette-DHS
Messages: 3220 Registered: February 2013
|
Senior Member |
|
|
Following is a response from DHS Research & Data Analysis Director, Tom Pullum:
Your recodes look fine. The problem is just with your specification of the subpop option for svy. What Stata expects for the argument (you have entered "subpopulationbw2") is a variable that has the value 1 for the subpopulation you want to restrict to. For example, you could have this line, "gen Punjab=1 if v024==1" and then specify the option with "subpop(Punjab)". Then to run the model for Sindh you would have "gen Sindh=1 if v024==2" and then specify the option with "subpop(Sindh)", etc. (If this doesn't work, try recoding as 0 or 1, but I think . or 1 is ok.) It's good that you are running the model with the subpop option rather than with "...if v024==1", etc. It's just that the specification of the argument is off.
|
|
|