Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Paul <paul@iheta.com> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | Re: st: Combining graphs |
Date | Wed, 12 Feb 2014 07:41:52 +1100 |
Austin thank you. I added the local `i' and tried adding kph in graph combine but the problem is not resolved local i=1 . foreach v of varlist HIP1824Px HIP1836Px HIP1819Px { 2. graph bar total_episd_amt if LOS>0 & hospital_group=="" & separation_fy=="2010/11", ov > er (COMPTOT, relabel(2 "Complication" 1 "NoComplication")) over(`v', >relabel(2 "`v'" 1 " > Other admissions")) title ("Mean episode amount overnight stays, public >hospitals 2010/11 > ") subtitle ("`v' with/without complications") name(panel`i') 3. local i=`i'+1 4. } . . graph combine panel1.gph panel2.gph panel3.gph,cols(1) file panel1.gph not found Any other suggestions? Paul Gross On 12/02/14 1:16 AM, "Austin Nichols" <austinnichols@gmail.com> wrote: >Paul <paul@iheta.com>: >You have not defined a local i so `i' is empty. > >On Mon, Feb 10, 2014 at 10:03 PM, Paul <paul@iheta.com> wrote: >> I have a very large file of 2.3 million hospital admissions, and am >>using >> stata v 13.1 on a MacBook Pro >> >> I want to create three bar charts of the hospital cost of complications >>for >> hip replacement, using three different icd codes for the hip >>procedures. I >> want to then combine the three in one graph. >> >> This seemed straightforward with the following loop: >> >> >> gen i=1 >> foreach v of varlist HIP1824Px HIP1836Px HIP1819Px { >> graph bar total_episd_amt if LOS>0 & hospital_group=="" & >> separation_fy=="2010/11", over (COMPTOT, relabel(2 "Complication" 1 >> "NoComplication")) over(`v', relabel(2 "`v'" 1 " Other admissions")) >>title >> ("Mean episode amount overnight stays, public hospitals 2010/11") >>subtitle >> ("`v' with/without complications") name(HIP`i') >> replace i=i+1 >> } >> >> The error message is : HIP1 is not a memory graph >> >> I have tried various combinations of the saving and name conventions, >> including double quotation marks around the `i' in the name, but none >>work. >> >> Any ideas, please? >> >> Paul Gross >> >* >* 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/ * * 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/