Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: AW: Loop over time


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: AW: Loop over time
Date   Thu, 11 Mar 2010 17:12:02 +0100

<> 



*************
clear*

inp byte(id time) sex:mylabel race:mylabel2, auto
1     2     M    W
1     3      .      .
2     1     F     H
3     1     F     B
3     2     .      .
3     3     .      .
end

compress
bys id (time): replace sex=sex[1]
bys id (time): replace race=race[1]

list, noobs sepby(id) 

*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Dmitriy
Krichevskiy
Gesendet: Donnerstag, 11. März 2010 17:06
An: statalist
Betreff: st: Loop over time

Hello Statalisters,
I have a small problem which I seem to be unable to solve. I have a
large panel dataset. But the creators of the data did not carry
variables such as race and gender beyond the first entry of an
individual in the dataset. I am attempting to fix this issue via
creating a simple loop but get an error message that time series
operators are not allowed (even though I have declared the dataset
xtset, and even tried tsset). Below I provide an examples of the data,
all help is much appreciated, as always. Dmitriy

id   time sex race ....
1     2     M    W
1     3      .      .
2     1     F     H
3     1     F     B
3     2     .      .
3     3     .      .


Research Associate, College of Education
Lumina Foundation Project
*
*   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   |   Site index