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: RE: looping twoway graph


From   "David Radwin" <[email protected]>
To   <[email protected]>
Subject   st: RE: looping twoway graph
Date   Tue, 24 Jan 2012 16:44:21 -0800 (PST)

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: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Lanciné Condé
> Sent: Tuesday, January 24, 2012 2:25 PM
> To: [email protected]
> 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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index