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: Unexpected errors using levelsof
From
Austin Nichols <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: Unexpected errors using levelsof
Date
Wed, 28 Aug 2013 13:52:14 -0400
Jose <[email protected]>:
After -levelsof-, the local has compound double quotes. Try
display `"`j'"'
instead of
display "`j'"
On Wed, Aug 28, 2013 at 1:46 PM, Morales Arilla, Jose
<[email protected]> wrote:
> Hi! Hope all is well.
>
> I am getting unexpected errors using levelsof on the WDI database. For
> instance:
>
> levelsof countryname if countrycode=="BRA", local(j)
> `"Brazil"'
>
> display "`j'"
> `Brazil"'" invalid name
> r(198);
>
> Without running display, I believe this problem manifests in a larger code
> trying to reference countryname of a given countrycode:
>
> . local y BRA
> . preserve
> . keep if countrycode== "`y'"
> (12985 observations deleted)
> .
> . levelsof countryname, local(j)
> `"Brazil"'
> .
> . #delimit ;
> delimiter now ;
> . twoway
> > (scatter FR_INR_RINR NE_GDI_TOTL_ZS, mlabel(year))
> > (line FR_INR_RINR NE_GDI_TOTL_ZS)
> > (lfit FR_INR_RINR NE_GDI_TOTL_ZS)
> > , title("Sensibility of Investment to Interest Rate")
> subtitle("`j'")
> > ytitle("Real Interest Rate") xtitle("Gross Capital
> Formation") legend(off) note("Data source: World
> > Development Indicators, 2013");
> too few quotes
> r(132);
>
>
> I get the same errors despite the countryname (I thought it may be due to
> the fact that some countrynames have spaces, hence messing with the code)
>
> Do you have any thoughts on what may be going on and how to solve it?
> Alternatively, is there any other code that could help me do the same?
*
* 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/