Statalist


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

Re: st: AW: RE: Problem importing data


From   "Ted Lundgren" <odovakar@spray.se>
To   <statalist@hsphsun2.harvard.edu>
Subject   Re: st: AW: RE: Problem importing data
Date   Thu, 12 Mar 2009 09:40:42 -0700

Thank you very much for your help so far!
Yes, Country is a string variable with the names of different countries. I was able to carry out the regression by using 'Encode country, gen(countrynum)' in the end, but now I was wondering: Have I done this correctly? 'Cause when I do this, I get a message that the ID variable is heavily weighted, or something like that.

Another question when I'm at it...In order to lag a variable two periods (for example), I just use the command 'L2.[variable]', right? Or should I use a minus sign in some way? (For example, in Eviews you simply write: 'variable(-2)', and that's it.


<-----Ursprungligt Meddelande----->
  From: Martin Weiss [martin.weiss1@gmx.de]
Sent: 12/3/2009 2:48:37 PM
To: statalist@hsphsun2.harvard.edu
Subject: st: AW: RE: Problem importing data 


<>

BTW, there is nothing wrong with year being treated as "int". See -help
data types-: The years conventionally found in today´s datasets are well
within the range of the maximum and minimum for "int"...




HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Howard Lempel
Gesendet: Donnerstag, 12. März 2009 15:30
An: statalist@hsphsun2.harvard.edu
Betreff: st: RE: Problem importing data

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/


*
* 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/
.

_______________________________________________________________
Eniro Supersök - är vad det heter




© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index