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:stubs, ending with some number, are not available for all waves :-reshape-


From   Clyde B Schechter <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re:st:stubs, ending with some number, are not available for all waves :-reshape-
Date   Sun, 26 Feb 2012 20:12:48 +0000

"What I tried is:
- ------------------------------------------------------
unab var: *1
local stubs: subinstr local vars "1" "",all
reshape long `stubs',i(id) j(wave)
- -----------------------------------------------------
 This causes problems for the variables that are not first created at
wave 1. However, if I use 20 instead of 1, I got similar problem for
those variables that are stopped being collected before wave 20."

That's a good start.  Try this:

local stubs
forvalues i = 1/20 {
    unab this_round: *`i'
    local this_round: subinstr local this_round "`i'" "", all
    local stubs: list stubs| this_round
}
reshape long `stubs', i(id) j(wave)

Clyde Schechter
Dept. of Family & Social Medicine
Albert Einstein College of Medicine
Bronx, NY, USA


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