Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: generate 3.000 dummies


From   Maarten buis <[email protected]>
To   [email protected]
Subject   RE: st: generate 3.000 dummies
Date   Wed, 25 Oct 2006 06:32:10 +0100 (BST)

--- Joseph McDonnell <[email protected]> wrote:

From: "Cristian Mackenna" <[email protected]>
> >Is there any fast way to generate a dummy for every of the 3.000
> id_place
> >
> 
> forvalues j=1(1)3000 {
>       gen dummy`j'=(id_place==`j')
> }
> 
> but I doubt you really want to go down that path. That number of
> dummies is 
> excessive to say the least.
> 

I also doubt you need it, but if you do I'd do and want to do it with
this loop I'd replace the line -gen dummy`j'=(id_place==`j')- with 
-gen byte dummy`j'=(id_place==`j')-. See: -help generate- and -help
data types- This will keep the size of your data down. Richard
Williams' suggestion (use -tabulate- with the gen option) is ofcourse
even easier.
HTH,
Maarten

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting adress:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


		
___________________________________________________________ 
The all-new Yahoo! Mail goes wherever you go - free your email address from your Internet provider. http://uk.docs.yahoo.com/nowyoucan.html
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index