Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Combining svy SEs with estat sd output and extracting it out of stata?

    Hello StataList-ers!

    I've used Stata on and off and have given it a real go recently, and its been fantastic but I've had a difficulty getting results out.
    I have my survey all set up and want to create weighted means, standard errors, and standard deviations (yes, weighted sd, you heard that right, its for population norms)

    So...

    svy: mean YVAR, over(agegroup)
    estat sd

    and presto I have two tables, first with mean and stand. errors and the second mean and standard deviation. All the information is correct.
    Now, I'm trying to find a way of calling the mean and standard error from the first and appending the standard deviation from the second and creating a third table as my output.

    I've played with esttab, estout and outreg2 and I have't quite managed it. I have to do this 144 times with different variables and over() categories.
    I thought I came the closest with esttab but no luck.

    Any suggestions?

  • #2
    It might be possible, but I don't know how to conveniently combine e-class estimates with a r-class matrix. My preferred solution to this type of problems is usually a plain matrix. For example:
    Code:
    svy: mean YVAR, over(agegroup)
    estat sd
    mat b=e(b)
    mat V=e(V)
    mat sd=r(sd)
    loc n=rowsof(V)
    mat est=J(`n',3,.)
    mat colnames est=b se sd
    
    forval i=1/`n'{
      mat est[`i',1]=b[1,`i']
      mat est[`i',2]=sqrt(V[`i',`i'])
      mat est[`i',3]=sd[1,`i']
    }
    mat list est
    Does this address your issues? A small function would be useful to repeat this process.

    Comment

    Working...
    X