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

Re: st: Creating a variable with gaps

From   Maarten buis <>
Subject   Re: st: Creating a variable with gaps
Date   Thu, 19 Mar 2009 08:43:56 +0000 (GMT)

--- 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 L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen


*   For searches and help try:

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