Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Question using macro in loop


From   Tak-wai Chau <[email protected]>
To   [email protected]
Subject   Re: st: Question using macro in loop
Date   Fri, 06 Apr 2007 16:04:30 -0400

First forget about the specific example I used before.

Now we have variables V1, V2,..., V10.
We have another variable W contains integer values between 1 and 10 inclusively.
We also have another variable Y contain numerical values.
I want to set Vi=Y if W==i for that observation and let other Vs unchanged for that observations.

So what can I do in this case?

Hope this is clearer now.

Thanks a lot!

Friedrich Huebler wrote:

--- Tak-wai Chau <[email protected]> wrote:
The key question I have in mind is whether we can, within a loop,
update one of the variables, and which variable to update is
according to the value taking by another variable. This value is
different across observations.
Yes, you can do that but your explanation is too vague. It is
difficult to help if you don't provide a clear rule for how values
should be replaced.

Friedrich


____________________________________________________________________________________
8:00? 8:25? 8:40? Find a flick in no time with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index