Announcement

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

  • Using groups, order, and select!

    Hello,

    Using groups, order and select, can we show another variable to see its corresponding values without the need to group it with the first variable. for example:

    Code:
    groups newvar , order(h) select(5) list var2
    I could not find the syntax in help page!

    Thanks

  • #2
    If you want to see the equivalent of a twoway table, specify two variables not one.

    groups is from the Stata Journal.

    Comment


    • #3
      On further thought, I guess you may be looking for something like this:

      Code:
      . webuse nlswork, clear
      . bysort race : groups age, select(5) order(high)
      
      ---------------------------------------------------------------------
      -> race = White
      
        +-------------------------------+
        | age   Freq.   Percent     %<= |
        |-------------------------------|
        |  24    1172      5.81    5.81 |
        |  23    1161      5.76   11.57 |
        |  25    1101      5.46   17.03 |
        |  22    1036      5.14   22.17 |
        |  26     977      4.85   27.01 |
        +-------------------------------+
      
      ---------------------------------------------------------------------
      -> race = Black
      
        +-------------------------------+
        | age   Freq.   Percent     %<= |
        |-------------------------------|
        |  25     450      5.60    5.60 |
        |  24     447      5.56   11.15 |
        |  23     422      5.25   16.40 |
        |  26     418      5.20   21.60 |
        |  22     411      5.11   26.71 |
        +-------------------------------+
      
      ---------------------------------------------------------------------
      -> race = Other
      
        +-------------------------------+
        | age   Freq.   Percent     %<= |
        |-------------------------------|
        |  23      21      6.93    6.93 |
        |  26      19      6.27   13.20 |
        |  24      17      5.61   18.81 |
        |  33      16      5.28   24.09 |
        |  25      15      4.95   29.04 |
        +-------------------------------+

      Comment


      • #4
        Thanks. I see this can work somehow on categorical variable, but what if the variable is not, and has thousands of values? When I tried it, it produce different results!

        Comment


        • #5
          I'm not sure what your question is. Age is a continuous variable but as is evident reporting as integer years is a common convention for adults. It is certainly true that the more decimal places are used in reporting, the less likely it is that any tabulations of frequencies are interesting or useful.

          Comment

          Working...
          X