Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: Problem with using loop and graph combine


From   saeid shahraz <[email protected]>
To   [email protected]
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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index