[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
RE: st: RE: RE: tabstat: how to save...
As Michael Blasnik has pointed out, this is not
even equivalent to what I suggested. The effect
. local incidnsum
is to leave -incidnsum- undefined so that
when you type
. scalar `incidnsum' = r(sum)
. scalar = r(sum)
and complains that "=" is an invalid
name. So the error message does point
in the right direction.
On why tempnames for scalars are a good idea,
and other related matters, the main doc is
at [P] scalar in v.9: I think it was in the
same places in v.8.
> The reason I said what I said is when I did:
> . do "C:\DOCUME~1\waterb\LOCALS~1\Temp\STD02000000.tmp"
> . local incidnsum
> . sum incidn, meanonly
> . scalar `incidnsum' = r(sum)
> = invalid name
> end of do-file
> . help scalar
> revealled some example on how to use scalar, where none was
> put in Stata quotes ` '. This led me to surmise that it is
> probably version issue of scalar syntaxes. But on closer look
> I realised that perhaps you are referring to may lax ( due to
> ignorance) use of -local- rather -tempname- in my -do- file,
> and consequently having to use -scalar- without `'. Is this
> what you meant by your warning? Although I think your warning
> refers to [P] Macro, I would appreciate if you can direct me
> to the pertinent reference in the manuals if this is
> assumption was not correct. Nevertheless, I have used your
> exact example using -tempname- and -scalar `foosum'-.
> > No, on this detail you are wrong and version
> > is not an issue.
> > So long as you follow my example and issue
> > tempname foosum
> > then after
> > su foo, meanonly
> > scalar `foosum' = r(sum)
> > is as valid as can be.
> > You are correct that you can do what
> > looks the same thing by
> > sum foo, meanonly
> > scalar foosum = r(sum)
> > but to do that is to live more dangerously.
> > If you do this, sooner or later you will
> > get burned, or bitten, by use of the same name in
> > different programs or use of identical
> > or similar names for scalars and variables.
> > The problem is aired in the manuals and
> > rehearsed once more in a Tip by G. Kolev
> > in Stata Journal 6(2), to appear next
> > month.
> > > Thank you Nick for your alternative suggestion.
> > >
> > > In Stata 8.2, scalar `foosum' = r(sum) is an invalid syntax
> > > but checking on-line help showed valid syntax as scalar
> > > foosum = r(sum). This suggestion worked for my purpose and as
> > > you alluded, shorter than tabstat.
* For searches and help try: