Dear Forum,
I will appreciate guidance on how I can create a new variable from stored results.
Specifically, I ran a logit model (#1, below) with postestimation margins (#2) to calculate probability of positive outcome (returned as "Margin" in #2). I would like to generate a new variable equal to the returned "Margin".
I thought if I used the "return list" function (#3, below) the "margin" will be returned under the scalars, and I could then use "generate newvar = r(margin)". However, the returned list of scalars does not have "margin".
Please kindly help with suggestions.
Regards,
Itai
__________
#1. logit hpt i.hiv i.sex i.race [pweight = wt_hiv], vce(robust) cformat(%9.2f)
#2. margins sex race, predict(pr) over(hiv) cformat(%9.2f)

#3. return list
I will appreciate guidance on how I can create a new variable from stored results.
Specifically, I ran a logit model (#1, below) with postestimation margins (#2) to calculate probability of positive outcome (returned as "Margin" in #2). I would like to generate a new variable equal to the returned "Margin".
I thought if I used the "return list" function (#3, below) the "margin" will be returned under the scalars, and I could then use "generate newvar = r(margin)". However, the returned list of scalars does not have "margin".
Please kindly help with suggestions.
Regards,
Itai
__________
#1. logit hpt i.hiv i.sex i.race [pweight = wt_hiv], vce(robust) cformat(%9.2f)
#2. margins sex race, predict(pr) over(hiv) cformat(%9.2f)
#3. return list
Comment