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]

st: looping through variables that are not consecutive and have common stem in name


From   David de Jong <[email protected]>
To   [email protected]
Subject   st: looping through variables that are not consecutive and have common stem in name
Date   Wed, 15 Jan 2014 16:12:08 -0500

Hi all,

I have the variables time1 correct1 time2 correct2 etc.

I'd like to loop through only the time variables, counting values that
are under 300 and not missing. I'm trying to use something like this:

qui forval j = 1/164 {

qui foreach v correct`j' {

replace count_sub300 = count_sub300 + (`v' < 300 & `v' < .)

}

}

It's not working. I'm quite sure that the 2nd line is not correct, but
can't figure out what it should be. Can anyone advise?

Many thanks,

David



~
David C. de Jong, MA
Department of Clinical and Social Sciences in Psychology
University of Rochester
214 Meliora Hall
Rochester, NY 14627
*
*   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