Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Creating a variable with gaps


From   "Johan Hellstrom" <[email protected]>
To   <[email protected]>
Subject   Re: st: Creating a variable with gaps
Date   Thu, 19 Mar 2009 09:54:12 +0100

Thanks Maarten. It worked fine.

Best,
Johan


--- On Thu, 19/3/09, Johan Hellstrom wrote:
> For graphing purposes I need to create a (filter-)variable
> that assign a value to every 1.000 observation (in total 
> there is about 80.000 observations). Although it could be
> done manually, can anyone tell me how to do this
> automatically?

gen byte filter = mod(_n, 1000) == 0

alternatively, if you want to make sure that all values 
are represented in your graph of variable x versus y
but that you don't plot the same point multiple times,
you could type:

bys x y: gen byte filter = _n == 1

Hope this helps,
Maarten

-----------------------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

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







*
*   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/



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