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:cumulative the looped results after -foreach-


From   Amanda Fu <[email protected]>
To   [email protected]
Subject   st:cumulative the looped results after -foreach-
Date   Sat, 18 Dec 2010 11:25:50 -0500

Dear Statalisters,

I  wondered how to easily indicate the list of all the results from a
loop without typing one by one.  It is kind of like cumulative the
looped results. An example is as following.
-------------------------------------
local var A B C D E F G X Y Z                    // create 7 dummy
variables for each variable in `var'
foreach v of var {
foreach i of a b c d e f g  {
   g  `var'`i'=.
      replace `var'`i'=1 if group==`i'
      replace  var'`i'=0 if group~=`i'
}
}
end                                                              //
how to indicate all the dummy variables created without typing all of
them out
----------------------------------
My question is : How to indicate the following list of variables
easily without typing each of them?
Aa Ab .....Ag Ba......Zg                 (variables are separated with blank)

Thank you!
Sincerely,
Amanda
*
*   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