Nick Cox writes:
> I had this hypothesis too. However, -twoway line-
> does not appear to be an r class command, so
> where the results getting overwritten?
A simple example:
.. sysuse auto
(1978 Automobile Data)
.. tab foreign
Car type | Freq. Percent Cum.
------------+-----------------------------------
Domestic | 52 70.27 70.27
Foreign | 22 29.73 100.00
------------+-----------------------------------
Total | 74 100.00
.. return list
scalars:
r(N) = 74
r(r) = 2
.. twoway line price mpg
(graph gets drawn -- not shown)
.. return list
..
I don't know who overwrote them, but they are gone!
Tom
> Steichen, Thomas J.
>
> > Jorge Morgenstern writes (in part):
> >
> > > I want a graph for each category (each country) in my
> > > dataset. I then generate the variable series and loop
> > > up to its maximum. What's really odd it's that, if I
> > > disable the twoway command, the list of countries
> > > displays correctly. If I enable it, only the first
> > > country is displayed, and only the first graph shows
> > > the title. The rest of the iterations generate an empty
> > > display line and an empty titled graph.
> > >
> > > egen series=group(country_codeifs)
> > > quietly tab series
> > > local cant=r(r)
> > > forval x=1/`cant' {
> > > local c= trim(country_name[r(N)/r(r)*`x']) *****this
> > > inputs the first
> > > record of each category to the title variable
> > > noi di " `c' "
> > > twoway (line exp_lblended mktdate if series==`x') ,
> > title(" `c' ")
> > > }
> >
> > The problem likely is that returned values r(N) and r(r) no longer
> > exist after -twoway- runs (they came from the -tab- outside of the
> > loop). Try saving them as macros before the loop then use
> > the macros.
>
> *
> * 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/
>
-----------------------------------------
CONFIDENTIALITY NOTE: This e-mail message, including any attachment(s),
contains information that may be confidential, protected by the attorney-
client or other legal privileges, and/or proprietary non-public
information. If you are not an intended recipient of this message or an
authorized assistant to an intended recipient, please notify the sender by
replying to this message and then delete it from your system. Use,
dissemination, distribution, or reproduction of this message and/or any of
its attachments (if any) by unintended recipients is not authorized and may
be unlawful.
*
* 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/