Site icon Stata.Professor : Your Partner in Research

Combine wide and nest

Hello! I would like to create a table that shows the effect of only one explanatory variable on several outcome variables in different models. Unfortunately, wide does not allow the keep option and I can´t figure out how to combine wide and nest. I will give an example:
 ssc install asdoc, replace
sysuse auto, clear

*I am only interested in the effect of one explanatory variable (mpg) //
9on two outcome variables (price and trunk) in two different models (with and without headroom)

 Effect of mpg |      in Model 1     in Model 2  
---------------+---------------------------------
      on price |          ?        	   ? 
      on trunk |          ?        	   ?

Suggestion on how to combine: 

asdoc reg price mpg rep78 , nest replace keep(mpg)
asdoc reg price mpg rep78 headroom, nest keep(mpg)

asdoc reg trunk mpg rep78, wide keep(mpg)
asdoc reg trunk mpg rep78 headroom, wide keep(mpg) 
I really hope, somebody can help me out!
Exit mobile version