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]

Re: st: looping graphs


From   Rodrigo Briceño <[email protected]>
To   [email protected]
Subject   Re: st: looping graphs
Date   Mon, 7 Jan 2013 11:36:21 -0600

thanks Nick, problem solved now!

2013/1/7 Nick Cox <[email protected]>:
> You are writing "set" for September dates. "sep" will work.
>
> Nick
>
> On 7 Jan 2013, at 17:11, Rodrigo Briceño <[email protected]> wrote:
>
>> Dear Stata users. I have developed the following do-file in order to
>> produce a set of 19 different graphs, each one with its corresponding
>> scale. I am able to produce the first graph but after that the do file
>> reports an error (invalid syntax, r(198);).
>>
>> I think that the problem is possibly related with the restore function
>> or with its position in the do-file. I am asking for a friendly help
>> to try to identify what I'm doing wrong.
>>
>>
>> *stata 11.2
>> set memory 100m
>> set more off
>> use "D:\data\panel382s.dta", clear
>> xtset isin t2
>>
>> gen liq_an=(liq/100)*52
>> label var liq_an "Liquidez Anual"
>>
>> *start and ending week
>>
>> *isin8    1    249
>> *isin18    1    137
>> *isin24    1    111
>> *isin29    37    237
>> *isin220    98    249
>> *isin221    118    249
>> *isin222    118    249
>> *isin225    1    249
>> *isin247    117    249
>> *isin249    118    249
>> *isin250    133    249
>> *isin251    126    249
>> *isin252    135    249
>> *isin254    142    249
>> *isin270    1    137
>> *isin272    1    120
>> *isin279    1    111
>> *isin281    1    236
>> *isin303    144    249
>>
>> local b8 "CRBCCR0B0104"
>> local b18 "CRBCCR0B2985"
>> local b24 "CRBCCR0B3199"
>> local b29 "CRBCCR0B3249"
>> local b220 "CRFPTG0B0013"
>> local b221 "CRFPTG0B0021"
>> local b222 "CRFPTG0B0039"
>> local b225 "CRFTCB0B0038"
>> local b247 "CRG0000B29G6"
>> local b249 "CRG0000B34G6"
>> local b250 "CRG0000B35G3"
>> local b251 "CRG0000B37G9"
>> local b252 "CRG0000B41G1"
>> local b254 "CRG0000B45G2"
>> local b270 "CRG0000B70F2"
>> local b272 "CRG0000B71F0"
>> local b279 "CRG0000B93F4"
>> local b281 "CRG0000B99F1"
>> local b303 "CRICE00B0051"
>>
>> local tin8 "tin(02jan2007, 22dec2011)"
>> local tin18 "tin(02jan2007, 24set2009)"
>> local tin24 "tin(02jan2007, 20mar2009)"
>> local tin29 "tin(20set2007, 28set2011)"
>> local tin220 "tin(10dec2008, 22dec2011)"
>> local tin221 "tin(13may2009, 22dec2011)"
>> local tin222 "tin(13may2009, 22dec2011)"
>> local tin225 "tin(02jan2007, 22dec2011)"
>> local tin247 "tin(06may2009, 22dec2011)"
>> local tin249 "tin(13may2009, 22dec2011)"
>> local tin250 "tin(26ago2009, 22dec2011)"
>> local tin251 "tin(08jul2009, 22dec2011)"
>> local tin252 "tin(09set2009, 22dec2011)"
>> local tin254 "tin(30oct2009, 22dec2011)"
>> local tin270 "tin(02jan2007, 24set2009)"
>> local tin272 "tin(02jan2007, 27may2009)"
>> local tin279 "tin(02jan2007, 20mar2009)"
>> local tin281 "tin(02jan2007, 21set2011)"
>> local tin303 "tin(13nov2009, 22dec2011)"
>>
>> foreach i in 8 18 24 29 220 221 222 225 247 249 250 251 252 254 270
>> 272 279 281 303{
>>
>> preserve
>> keep if isin == `i'
>> #delimit ;
>>
>> twoway (line sfid sem if `tin`i'', clpattern(dash))
>> (line liq_an sem if `tin`i'', yaxis(2)),
>> ytitle(SFID como % emision, size(medsmall) color(blue) margin(small)
>> axis(1))
>> ytitle(LIQ_ANUAL, size(medsmall) color(blue) margin(small) axis(2))
>> ylabel(#10, labsize(medsmall)) xtitle(SEMANA, size(medsmall)
>> color(blue) margin(small))
>>
>> xlabel(#15, labsize(medsmall)) title(`b`i'', size(medsmall));
>> #delimit cr
>> restore
>>
>> graph export "D:\data\g_`i'.wmf"
>> }
>> *
>> *   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/



-- 
Rodrigo Briceño
Economist
[email protected]
SKYPE: rbriceno1087

*
*   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