Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: combining data on same case from different lines


From   Marcelo Jenny <[email protected]>
To   [email protected]
Subject   Re: st: combining data on same case from different lines
Date   Fri, 25 Jun 2010 16:03:42 +0200

Great!

Thanks to both of you, Richard and Nick. I was toiling with loops and getting nowhwere.

Marcelo


Am 25.06.2010 15:42, schrieb Richard Goldstein:
replace date=date[_n-1] if date==.&  id==id[_n-1]

there is an analogous line for publication but use _n+1 instead (as well
as changing variable names as appropriate

you can then drop as desired (if you use the line at the top of this
email, you can then -drop if publication==""=)

Rich

On 6/25/10 9:25 AM, Marcelo Jenny wrote:
Hello Nick,

thanks for the reply. It's not that easy :)

The table got bungled in the last email:
id date      stage      publication
1  01oct1990 indictment
1            indictment journal 3
2  10may1995 indictment
2            indictment journal 5

I want to arrive at a table with complete data on all variables for all
cases. This means either the data in the variable 'publication' in the
second
line of case 1 needs to be copied into the first line or the data in the
variable 'date' needs to be copied into the second line.

Afterwards I can drop the now unnessary second line for each case in
the way you suggested.

Marcelo

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



--
Dr. Marcelo Jenny
Universität Wien
Institut für Staatswissenschaft/AUTNES
Hohenstaufengasse 9/7/4. Stock
A-1010 Wien
Tel.:++43-1-4277-49706
E-Mail: [email protected]
http://staatswissenschaft.univie.ac.at/

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index