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

st: local macro tempvar troubles

From   "Timothy Dang" <>
To   stata <>
Subject   st: local macro tempvar troubles
Date   Tue, 2 Oct 2007 20:55:07 -0700


I'm using Stata/IC 10.0 on a Mac, just in case that matters.

I'm writing a .do file using -ml- . I don't think that matters, but in
any case, in the likelihood program I generate a lot of temporary
variables, like so:
    tempvar prHeart prSpade prClub prDmd
    tempvar valMix valHt valSpd valClub valDiamond
    tempvar MixLove expHeart expSpade expClub expDiamond expSum

	gen double `prHeart'=0
	gen double `prSpade'=0
	gen double `prClub'=0
	gen double `prDmd'=0
	gen double `valMix'=0
	gen double `valHt'=0
	gen double `valSpd'=0    // concentrate on this line
	gen double `valClub'=0
	gen double `valDiamond'=0

On the line which says "gen double `valSpd'=0", it originally said
"gen double `valSpade'=0". There was trouble with that, though. When I
ran the program, it appeared that `valSpade' was null--it replaced the
line with "gen double =0".

I "fixed" the problem by doing a search/replace all from "valSpade" to
"valSpd". For some reason, that actually DID fix the problem. Now, the
same thing is happening with the last line above. For the valSpd line
it's nicely doing "gen double __00000S=0". For "gen double
`valDiamond'=0" it makes "gen double =0", causing the error: "too few
variables specified".

This kind of problem has been dogging me this evening, with different
variable/macro names being the trouble. I'm flummoxed. Anyone know
what I'm foolishly overlooking?


Timothy O'Neill Dang / Cretog8
One monkey don't stop no show.
*   For searches and help try:

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