[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: Re: tsset
Juan Manuel Jauregui wrote
> I have a panel data of countries and years and when
> entering the command
> tsset country year
> I receive the error message that the string
> is not allowed. Obviously country is a string. How can I solve this
> problem? Do I have to create
> an id number for each country? How can I do that?
and ACHINTYA RAY replied
> I faced the same problem in my work. So I took the harder
> route and created
> a numeric ID for each country in Excel and then got the data
> into STATA. In
> Excel, this is a piece of cake after you sort your data by
> the country name.
> But taking the harder route saved a lot of time for me. May
> be there is a better way out.
This is also easy in Stata. Indeed it doesn't require
even a prior sort. Use -encode-.
. encode country, gen(Country)
. tsset Country year
gives advice in this area.
* For searches and help try: