Announcement

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

  • Listing out the frequency distributions for multiple variables

    Hello!

    Quick question - I have data from a survey where participants can select multiple options for race. It comes across in our dataset as multiple yes/no (1/0) variables for each race category. I am trying to collapse them - but first I want to look at how these are distributed throughout the dataset. I am familiar with how to do this is SAS. It would be something like this:

    proc freq data=have;
    table var1*var2*var3*var4*var5/list missing; run;

    I also use this a lot to check to make sure my newly created variables are correct. How can I replicate a similar output in STATA?

    Thanks!

  • #2
    While there are some Forum members who also use SAS, I would guess they are a minority. It would have been more helpful to mock up an example of the kind of output you want.

    Since I can't imagine how SAS or any other software would produce a 5 dimensional cross-tabulation, I'm guessing that what you're looking for is some tabulation of all 243 possible combinations of yes/no/missing responses in your data set. You can get that in Stata with:

    Code:
    contract var1 var2 var3 var4 var5, zero
    for bare-bones output. Read -help contract- for information about options that add on to that. Since there will be 243 combinations, listing them out is possible (-list, noobs clean-), but probably less helpful than just viewing the results in the data Browser.

    Comment


    • #3
      I have never used SAS and don't know what kind of output you seek, but groups (Stata Journal) may help.

      https://www.statalist.org/forums/for...updated-on-ssc gives a quick overview.

      Code:
      . search st0496, entry
      
      Search of official help files, FAQs, Examples, and Stata Journals
      
      SJ-18-1 st0496_1  . . . . . . . . . . . . . . . . . Software update for groups
              (help groups if installed)  . . . . . . . . . . . . . . . .  N. J. Cox
              Q1/18   SJ 18(1):291
              groups exited with an error message if weights were specified;
              this has been corrected
      
      SJ-17-3 st0496  . . . . .  Speaking Stata: Tables as lists: The groups command
              (help groups if installed)  . . . . . . . . . . . . . . . .  N. J. Cox
              Q3/17   SJ 17(3):760--773
              presents command for listing group frequencies and percents and
              cumulations thereof; for various subsetting and ordering by
              frequencies, percents, and so on; for reordering of columns;
              and for saving tabulated data to new datasets

      Comment

      Working...
      X