Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: encode command


From   Ronnie Babigumira <rb.glists@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: encode command
Date   Fri, 12 Oct 2012 14:30:44 +0200

the variable you generated, country_1, has those numbers already no?

input str10 country
Greece
Germany
Spain
Italy
end

list
encode country, gen(country_1)
list
list, nolabel



-- 
010100100110111101101110011011100110100101100101




On Friday, October 12, 2012 at 2:23 PM, Caterina.ASTARITA@ext.ec.europa.eu wrote:

> Dear Statalisters, 
> 
> Using list country_1, nolabel, I manage to visualize the numbers in the main windows of results, but what if I want to generate a new variable that includes these numbers? 
> 
> Thanks, 
> 
> Caterina
> 
> 
> Date: Thu, 11 Oct 2012 13:58:59 +0100
> From: Nick Cox <njcoxstata@gmail.com (mailto:njcoxstata@gmail.com)>
> Subject: Re: st: encode command
> 
> list country_1, nolabel
> 
> On Thu, Oct 11, 2012 at 1:49 PM, <Caterina.ASTARITA@ext.ec.europa.eu (mailto:Caterina.ASTARITA@ext.ec.europa.eu)> wrote:
> 
> > In the dataset I am using the names assigned to different countries are strings. My variable name is "country"
> > I use the command "encode country, gen(country_1)" in order to transform the string into numbers
> > But still country_1 shows as a name and not a number. What if I would to visualize countr_1 as a column of numbers in the dataset?
> 
> 
> *
> * 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/



*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index