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]

Re: Re: st: binary indicator for differing subsets of variables [SEC=UNCLASSIFIED]


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: Re: st: binary indicator for differing subsets of variables [SEC=UNCLASSIFIED]
Date   Fri, 9 Sep 2011 00:55:46 +0100

I didn't read your previous carefully enough. With just start and end
date variables you could do this

 gen myindicator = 0
 unab LFS : LFS*
 local LFS : subinstr local LFS "LFS" "", all

qui foreach v of local LFS {
     replace myindicator = myindicator + LFS`v' if  inrange("`v'", date1, date2)
}

replace myindicator = myindicator == 6

On Fri, Sep 9, 2011 at 12:35 AM, Fry, Jane <Jane.Fry@pc.gov.au> wrote:
> Thanks Nick -- after I set up the intervening date variables (as I only had
> the start and end set up before) this worked a treat!!!
>
> Very grateful for your help.
>
> Cheers,
> Jane.
>
>
>
> Important Notice
>
> This e-mail and attachments (if any) is intended for the original addressee only.
> If you are not the intended recipient, any use or dissemination of this communication is prohibited.
> Please advise the sender by return e-mail and delete this e-mail.
>
> *
> *   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