Announcement

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

  • Using tabout command for creating a oneway table

    Hello.
    I am having trouble with -tabout- commands,
    even though I am carefully reading through the manuals..

    I have to create a oneway table on a sub-population(boys, gender=1) that is based from survey data
    what percentage of them are vaccinated or not(vaccine), the standard error of the population, and the number of observations used to estimate.

    I tried using
    tabout vaccine if gender==1 using table.txt, svy oneway per se obs replace
    tabout using table.txt, svy oneway vaccine if gender==1 cells(per se obs) replace
    tabout vaccine if gender==1 using table.txt, svy oneway replace per se obs

    and so many other commands and it simply doesn't work....


    Can someone help me with this simple command?
    I want to use the bolded commands to create the table.


    Thank you so much in advance!




  • #2
    Dear Beatrice, please provide us some more details about what exactly do you mean by
    "it simply doesn't work..."
    Does the Stata recognize the -tabout- (user written command). Do you get any specific error. Please say exactly what you typed and exactly what Stata typed in response.

    Comment


    • #3
      Oh yes..
      If I use
      tabout vaccine if gender==2 using table1.txt, cells(se) svy oneway replace per obs
      option obs not allowed
      r(198);


      If I use
      tabout vaccine if gender==2 using table1.txt, cells(se obs) svy oneway replace per obs
      One of your cell entries is invalid


      This is just simple command problem, I think...


      I cannot think of any -tabout- command that will give me the output of a oneway survey table with percentage, standard error and observation numbers...


      Comment


      • #4
        O.K, now I see.
        1. according to the help file the number of observations must come first in the cell, before the standard error.
        2. the number of observations can't be included as an option outside the cell() option.
        3. in the svy options there is a difference in the number of observations (n) and the weighted cell (freq).
        4. follow the instructions in the help file and especially this manual for more options.

        below you'll find an example of these kind of tables, just change the names of the variables.


        Code:
        sysuse nlsw88, clear
        gen wt = 10 * runiform()
        svyset [pw=wt]
        tabout coll using mytable.txt if race==1, ///
         npos(lab) c(freq se) f(1 2) clab(OBS SE) svy replace
        
        tabout coll using mytable.txt if race==2, ///
         npos(lab) c(freq se) f(1 2) clab(OBS SE) svy append 
        
         * alternatively, if you are running the same command by gender, then why not create a two-way table
         tabout coll race using mytable.txt, ///
         npos(lab) c(freq se) f(1 2) clab(OBS SE) svy append

        Comment

        Working...
        X