Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Problem with using loop and graph combine


From   saeid shahraz <shahraz@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Problem with using loop and graph combine
Date   Tue, 2 Oct 2012 22:07:04 -0400

Hello there,
I am seeking for help as for using graph combine command in a loop.
Here is the intro to the problem.

I have number of death for 168 countries for 3 years.
Variables: country (string 3 digit ISO codes), year(numeric) death(numeric)

I tested my scripts on the first 5 countries and got rid of the rest of data.

Here is the script:

levelsof country, local(b)
                           foreach i of local b{
                           graph drop _all
                           graph hbar Deaths_B_total,
over(year,lab(labsize(small)) gap(200)) title("`i'") name(`i')
                   *gr save  ("`i'")
                    local z "`z' `i'"
                    }

Result: It creates the individual graphs one at a time but produces
the following error message in the end:

AFG is not a memory graph
r(198)

I appreciate if someone can help me figure this out.

Regards,

Saeid Shahraz MD, PhD student
Heller School of Social Policy
Brandeis University
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index