I'm using national survey data to analyze health outcomes for particular population groups.
Here is the general syntax I am using:
Code:
parmby "svy:tab outcome popgroup, per cv col obs ci", by(popgroup) saving("C:\5_Output\20152016\Outcome.dta", replace)
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float popgroup byte parmseq str3 parm double(estimate stderr) int dof double(t p min95 max95) 1 1 "p11" .560834577206477 .02379619483675597 999 23.568246144135752 5.168916765126432e-98 .5141383174611011 .607530836951853 1 2 "p21" .3553112377868799 .02398013930267794 999 14.816896319997655 4.766187597301973e-45 .3082540161894792 .4023684593842806 1 3 "p31" .08385418500664327 .015043233427842367 999 5.574212845188189 3.198587014389983e-08 .054334224341679505 .11337414567160703 2 1 "p11" .589174127347504 .012688895501107814 999 46.432262547679244 1.0480875851500087e-251 .5642741816096903 .6140740730853176 2 2 "p21" .2977697297706131 .012302952288209731 999 24.20311180560899 3.2690964454236406e-102 .27362713640111247 .32191232314011375 2 3 "p31" .1130561428818826 .007555275426451131 999 14.96386782751445 7.886732085020856e-46 .09823011266227483 .12788217310149036 3 1 "p11" .6373536315167009 .005199146365684373 999 122.58813018294491 0 .6271511310408171 .6475561319925847 3 2 "p21" .2522510835703473 .004510844734417346 999 55.92102996711322 6.02180206568721e-310 .24339926592326463 .26110290121742996 3 3 "p31" .11039528491294992 .003232680308839218 999 34.14976872630822 5.458448012639935e-170 .10405166231232503 .11673890751357481 end
I am using parmest and parmby from SSC in Stata 15.1 to save just the data I am interested in. The problem is that I only get the estimate (proportion) and upper and lower confidence intervals. What I would also like to save is the observations and coefficient of variation, but I cannot figure out how to do this. I have used a matrix before, but I like that parmest and parmby can save my output while not disrupting my working dataset.
Is there an option to save the obs and cv using parmest or parmby? Also, if there is a way to maintain the data labels given to the variables in the original working dataset, that would be great!
If not, is there another command that will save all of the desired results (percentage, cv, obs, upper ci, lower ci)?
Thank you for your help,
0 Response to Saving obs with parmest or parmby
Post a Comment