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: Generating a variable by assigning value form another variable


From   daniel klein <[email protected]>
To   [email protected]
Subject   Re: st: Generating a variable by assigning value form another variable
Date   Wed, 13 Jul 2011 09:08:22 +0200

Try something like

forval j = 101/110 {
   loc k = substr("`j'", 2, .)
   replace hrs = hrs`k' if main_owner == "`k'"
}

You can probably use a nested loop to cover the 10 years you mentioned
in your first post.

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