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]

From |
Alison El Ayadi <aelayadi@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

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/

**Follow-Ups**:**Re: st: RE: identifying highest number of consecutive variables where answer is consistent across observation***From:*Nick Cox <njcoxstata@gmail.com>

**References**:**st: identifying highest number of consecutive variables where answer is consistent across observation***From:*Alison El Ayadi <aelayadi@gmail.com>

**st: RE: identifying highest number of consecutive variables where answer is consistent across observation***From:*Joe Canner <jcanner1@jhmi.edu>

**Re: st: RE: identifying highest number of consecutive variables where answer is consistent across observation***From:*Alison El Ayadi <aelayadi@gmail.com>

**RE: st: RE: identifying highest number of consecutive variables where answer is consistent across observation***From:*Joe Canner <jcanner1@jhmi.edu>

*From:*Alison El Ayadi <aelayadi@gmail.com>

**RE: st: RE: identifying highest number of consecutive variables where answer is consistent across observation***From:*Joe Canner <jcanner1@jhmi.edu>

- Prev by Date:
**st: generating annualized standard deviation of returns from monthly data.** - Next by Date:
**st: RE: generating annualized standard deviation of returns from monthly data.** - Previous by thread:
- Next by thread:
- Index(es):