Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Category sizes in IF statements - how?
From
Eric Booth <[email protected]>
To
"<[email protected]>" <[email protected]>
Subject
Re: st: Category sizes in IF statements - how?
Date
Mon, 28 Feb 2011 18:49:56 +0000
<>
********!
//setup//
sysuse census, clear
expand 50 in 20/40
count if state== "Oregon"
count if state== "Alabama"
//gen catsize//
bys state: g catsize = _N
ta state catsize
//create dummies//
ta state if catsize >40, g(s_)
desc s_*
**********!
- Eric
__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
[email protected]
Office: +979.845.6754
Fax: +979.845.0249
http://ppri.tamu.edu
On Feb 28, 2011, at 12:41 PM, Jan Fredrik Hovden wrote:
> Is there a simple way to use the size of a category as a condition of an IF statement?
>
> Take for example the variable AUTHOR, which includes about 1000 different authors. I would like to make a dummy for some of these authors (using either TAB,GEN() or DUMMIESLAB - but not for everyone, only for categories including at least 40 persons.
>
> IN OTHER WORDS: What I would like is to do something like this (written in English):
>
> . dummieslab AUTHOR if categorysize>20
>
> I would greatly appreciate any idea f.
>
> Jan Fredrik Hovden
> Associate professor, Department of Information and Media Science
> University of Bergen, Norway
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/