Announcement

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

  • svy: proportion, mean or ratio in Stata 16 and how to get value labels e(label1) or e(over_labels)

    Dear Stata users,

    I am producing descriptive statistics using proportion, mean or ratio. Until today I was using Stata 15 and the exact code Ive been using is:

    Code:
        matrix drop _all
        levelsof year, local(year)
        foreach y of local year {
        forval i = 1/2 {
        svy, subpop(if year==`y' & j1==`i' & dummy_1==1): proportion d8
        matrix A`i'`y'=r(table)'
        matrix rownames A`i'`y'=`e(label1)'  
        local dimA`i'`y' `=rowsof(A`i'`y')'
        matrix Y`i'`y'= J(`dimA`i'`y'',1,`y') 
        matrix colnames Y`i'`y' = "year"
        matrix S`i'`y' = J(`dimA`i'`y'`z'',1,`i')
        matrix colnames S`i'`y' = "sex"
        matrix R`i'`y'=A`i'`y',Y`i'`y',S`i'`y'
        matrix F`i'`y' = R`i'`y'[1..`dimA`i'`y'', "year"], R`i'`y'[1..`dimA`i'`y'', "sex"], R`i'`y'[1..`dimA`i'`y'', "b"], R`i'`y'[1..`dimA`i'`y'', "ll"], R`i'`y'[1..`dimA`i'`y'', "ul"]
        }
        }
    
        matrix Q =F12016 \ F22016 \ F12019 \ F22019
        putexcel A1="Service sought" A2=matrix(Q), names
    As you can see, I am saving the estimates in a matrix format and exporting it to excel using the putexcel function. Today, however, I started using Stata 16 and the option e(label1) or e(over_labels) is no longer available. Any advice on how to get these labels?

    Thanks a lot!
Working...
X