Announcement

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

  • Retrieve values from a tabulate, with svy option.

    Hi,

    I would need your help to retrieve numerical values from a tabulate, with weights (svy function). I already success to get percentage (from my binary variable, coded 1 and 0), but I can't get the confidence intervals back. I would like to put them in a matrix since I have a large number of variables (60-80).

    For percentage value I success with this command :

    "
    svy : tab DurHebdBaseballBin, ci perc
    ereturn display
    matrix a = r(table)
    "

    But for confidence intervals values are differents from my original table (because of mean calculation while I have percentage for IC).

    So my question is is it possible to get the data from a table with weights?

    Table where I would like to retrieve the data :
    Click image for larger version

Name:	2022-04-26_16h25_35.png
Views:	2
Size:	7.3 KB
ID:	1661683

    I would like to export percentage value, lb and ub values in a matrix.

    Thanks a lot for your help,
    Jérôme

  • #2
    You are not showing reproducible example, but generally there are two sources from where you can retrieve information after a command: -ereturn list- and -return list-.


    Type both of these after your command, and if what you need is there, then you can retrieve it. If not, it gets difficult.

    Comment


    • #3
      Thanks for your advices. Finally, I was helped, and probably retrieve CI with a tabulate and svy function is not possible. BUT it's possible with proportion. Here is my code :

      svy : proportion `var'
      return list
      matrix a = r(table)
      matrix perc = a[1,2]
      matrix IC1 = a[5,2]
      matrix IC2 = a[6,2]
      matrix tot = perc, IC1 , IC2

      Comment


      • #4
        For asdocx users!
        asdocx can now export confidence intervals from the svy:tab command. Here is a quick example. Complete blog entry can be found on the asdocx page for svy:tab.
        Code:
        webuse nhanes2b
        svyset psuid [pweight=finalwgt], strata(stratid)
        ‏‏‎ ‎
        asdocx svy: tabulate race, format(%11.3g) count ci
        Click image for larger version

Name:	confidence interval.PNG
Views:	1
Size:	56.9 KB
ID:	1763904
        Regards
        --------------------------------------------------
        Attaullah Shah, PhD.
        Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
        FinTechProfessor.com
        https://asdocx.com
        Check out my asdoc program, which sends outputs to MS Word.
        For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

        Comment

        Working...
        X