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: RE: identifying highest number of consecutive variables where answer is consistent across observation


From   Alison El Ayadi <[email protected]>
To   [email protected]
Subject   Re: st: RE: identifying highest number of consecutive variables where answer is consistent across observation
Date   Wed, 26 Feb 2014 20:03:44 -0800

Dear Statalisters -

I have been using the below code to identify the runs of consecutive
variables where answer is consistent across observations (my thanks to
Joe Canner) -

gen run=0
replace run_15=0
forvalues x=1/93 {
local y=`x'+1
replace run=run+1 if  q`x'==q`y' & !mi(q`x')
replace run=0 if q`x'!=q`y' & run_15==0
replace run_15=1 if run==14
}

I now am in the situation where I have received an updated dataset
that excludes certain variables (q4 q33 and others).  I wonder if
there is an easy way to tell this program to exclude certain values
but still run consecutively across those variables that are present?

Thank you!
Alison
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index