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: Importing String Variables ruins access to variable categories
From 
 
Sara LaPlante 
To 
 
[email protected] 
Subject 
 
Re: st: Importing String Variables ruins access to variable categories 
Date 
 
Thu, 15 Sep 2011 11:19:45 -0400 
That worked!  I've never had to do that before, but what an easy fix.  Thank you!
On Sep 15, 2011, at 11:14 AM, Dimitriy V. Masterov wrote:
> Try using quotes fix this, like this:
> 
> table male if nation=="england"
> 
> 
> DVM
> 
> On Thu, Sep 15, 2011 at 11:09 AM, Sara LaPlante
> wrote:
>> Hi,
>> 
>> I am trying to import data into Stata 11 from a Mac.  I have access to a PC, but it only has Stata 8.  I emailed myself the data file as a .csv and was able to open the data with one problem- something is wrong with all my string variables.  For example, when I try to find out what the gender distribution is only for people from England, I type in the following and get the following error message:
>> 
>> table male if nation==england
>> yemen not found
>> r(111);
>> 
>> However, this command works fine for any numerical data.  In the example above, England is not just a label.  That is, nation is not coded as japan=1, england=2, etc.  Because I can type in the following command and get the same error message:
>> 
>> table male if nation==england
>> type mismatch
>> r(109);
>> 
>> Is there a way to fix this on my Excel file?  I would like to avoid manually recoding all my string variables into numerical values.  Any help would be appreciated!
>> *
>> *   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/
*
*   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/