Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Lanciné Condé <condela73@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: RE: looping twoway graph |
Date | Wed, 25 Jan 2012 07:02:48 +0100 |
Thanks David. You was right about the "if" omitted on the first line. Best regards CONDE 2012/1/25 David Radwin <dradwin@mprinc.com>: > It's difficult to answer this question definitively given the limited > amount of information you gave (such as the values for cbm). But to start > with, the first line > > keep ecowas==1 > > should be > > keep if ecowas==1 > > This should drop the other 55 countries. Test it by using -count- before > and after, like: > > > . clear > > . set obs 68 > obs was 0, now 68 > > . gen ecowas=cond(_n<14, 1, 0) > > . count > 68 > > . keep if ecowas==1 > (55 observations deleted) > > . count > 13 > > David > -- > David Radwin > Research Associate > MPR Associates, Inc. > 2150 Shattuck Ave., Suite 800 > Berkeley, CA 94704 > Phone: 510-849-4942 > Fax: 510-849-0794 > > www.mprinc.com > > >> -----Original Message----- >> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner- >> statalist@hsphsun2.harvard.edu] On Behalf Of Lanciné Condé >> Sent: Tuesday, January 24, 2012 2:25 PM >> To: statalist@hsphsun2.harvard.edu >> Subject: st: looping twoway graph >> >> Dear All >> I had a sample of 68 developing countries. I want to chart var1 and >> his trend for only 13 of them (not necessairely consecutives). >> I have created a dum called ecowas=1 for each of the 13 countries of >> interest. Then I implemented the following commands: >> >> keep ecowas==1 >> levelsof cbm, local(id) >> foreach i of local id { >> local lab: label cbm `i' >> twoway (line var1 an if cbm==`i', clpattern("-###") sort clwidth(0.6)) >> (line trendvar1 an if cbm==`i', sort), scheme(s1mono) subtitle(`lab') >> graphregion(fcolor(none) lcolor(none) lwidth(none) lpattern(blank)) >> saving(`lab'tcer) >> } >> >> By doing so I obtain more graphics than I want. First I have the13 >> graphics escompted then 55 more blank graphics. Can anyone help me to >> stop after the 13 graphics I need? >> >> Best Regards >> * >> * For searches and help try: >> * http://www.stata.com/help.cgi?search >> * http://www.stata.com/support/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/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/statalist/faq * http://www.ats.ucla.edu/stat/stata/