Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Encode generates a wrong list


From   "Mike Kim" <[email protected]>
To   <[email protected]>
Subject   st: Encode generates a wrong list
Date   Tue, 29 Dec 2009 17:29:40 -0600

Dear statalisters,

I have 60 countries in my dataset. "cntrystr" is string variable. To change 
it into a numeric variable, I used the following code:

encode cntrystr, gen(cntry)
label list cntry

It lists 60 countries. Then, I dropped 10 countries and wanted to generate a 
new label list by the following code:

drop cntry
encode cntrystr, gen(cntry)

However, Stata gives the same 60 countries. This is a problem because I want 
to use "forvalues i=1/50 {... }" for my analysis and it is interrupted due 
to missing country numbers. How can I remove dropped countries in 'encode"?

Thank you in advance.
Mike. 

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index