Statalist


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

Re: st: Creating a variable with gaps


From   Johannes Geyer <JGeyer@diw.de>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Creating a variable with gaps
Date   Thu, 19 Mar 2009 09:45:17 +0100

> Johan Hellstrom:
> 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?

You could work with a loop and -in-:

************************************
gen x = .
qui des
forvalues m = 1(1000)`r(N)' {
        replace x = something in `m'
        }
************************************

Note that this assigns a value to observation 1, 1001, 2001, ... , last 
observation. 


Johannes



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



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