Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: RE: indirect evaluation of variables


From   "b. water" <[email protected]>
To   [email protected]
Subject   RE: st: RE: indirect evaluation of variables
Date   Mon, 31 Mar 2003 14:27:29 +0000

dear nick,

thanks for your reply. i am writing as someone who uses stata pragmatically first and foremost while learning more stuffs on the side (e.g. macros and do's, programming is further down the road). so if you feel you prefer not to further the discussion on this particular topic, i do not mind as the alternative command line instruction works. it's just your macro that did not work and am trying to understand why it did not work as a learning experience for me.

i have changed the data bleen to b1een as in b(one)een rather than blee as in b(l for lima)een and correspondingly changed all ambigious looking l to 1 (as in changing all l(lima)'s and 1(one)'s to 1(one)'s so that there's no ambiguity. correspondingly, i have changed the command line instruction to:

gen b1ob = cond(b1een == "ing", b1ing, b1am)

i.e. changing all the l(lima)'s to 1(one)'s

this worked.

then i run the macro, again changing all the l(lima)'s and 1(one)'s to 1(one)'s just so there's no ambiguity, and i got the same error message.


. drop b1ob

. do "C:\My Documents\untitled.do"

. gen b1ob = .
(4 missing values generated)

. forval i = 1 / `= _N' {
2. replace b1ob = b1`= `b1een'[`i']' in `i'
3. }
b11 not found
r(111);

end of do-file
r(111);

so, am still puzzled but if you prefer to leave it at that, i'll leave it at that. thanks for your input.

bw






From: "Nick Cox" <[email protected]>
Reply-To: [email protected]
To: <[email protected]>
Subject: RE: st: RE: indirect evaluation of variables
Date: Mon, 31 Mar 2003 13:31:26 +0100

b. water
>
> tried to run your macro:
>
> . gen blob = .
> (4 missing values generated)
>
> . forval  i = 1 / `= _N' {
>   2. replace blob = bl`= `bleen'[`i']' in `i'
>   3. }
> bl1 not found
> r(111);
>
> end of do-file
> r(111);
>
> but that was the result.
>
> however, gen blob = cond(bleen == "ing", bling, blam) worked.
>
> quite curious as to why the macro did not work but i am ok with the
> alternative.

This works for me. Perhaps you miscopied Bill Rising's
"data".

Nick
[email protected]

*
*   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/

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail

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