Statalist


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

st: RE: Problem importing data


From   Howard Lempel <HLempel@brookings.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Problem importing data
Date   Thu, 12 Mar 2009 10:29:38 -0400

Hi there,

You'll get a better answer if you give a bit more detail.  Two things that would be particularly helpful: 1) What exactly does your data look like?  Is "country" a string variable with the names of different countries?  Or does it consist of numbers that are codes for countries?  2) Exactly what commands have you typed into Stata so far and exactly what error message did you get?

That being said, you may want to take a look at -help encode-, which creates a new variable giving assigning a unique number to each value of a string variable.  If your country variable already consists of numbers, -help destring- will convert it to a numeric variable.  Some non-numeric characters may have found their way into your country variable, in which case, you'll need to eliminate those before -destring-ing.

Once you convert country to a numeric variable, you should be able to -xtset- your data, which tells Stata that your data is a panel and specifies which variables contain your cross-sectional and time units.

Lastly, you might want to try importing your data using the Stata command -xmluse- or saving your data as a CSV and using -insheet-.

Hope this helps.
Howie
 
________________________________________
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Ted Lundgren
Sent: Thursday, March 12, 2009 10:13 AM
To: statalist@hsphsun2.harvard.edu
Subject: st: Problem importing data

Hi all,

I am new to Stata (have been using Eviews earlier), and despite this excellent forum I'm still having trouble getting my panel data right. I have a "normal" panel so to speak, with "Country" in the first column, "Year" in the second, and then the variables. When I try to get the data into Stata from Excel by either Stattransfer or Copy/Paste, "Country" is all the time being treated as a string variable, no matter what I do. Therefore, the panel can't be estimated, i.e. I am getting an error message. "Year" is also being treated as 'Int'. What am I  doing wrong?

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