Thomas Heckelei [mailto:[email protected]]
> I'm a stata beginner and have a recoding problem.
>
> Cross sectional units in my panel data set are currently
> identified by
> names (string variables). I want to make an integer variable
> out of it such
> that it has a new (ascending) value for each new unit. All
> the standard
> routines to "destring" and recode that I could find looking
> at the help
> file would require me to type all the names (>400) at least once.
>
> It might be important to know that the number of time
> observations differ
> between units (unbalanced).
>
> Is there any possibility to do this within state or do I
> better go back to
> excel or gauss for that?
Encode will do what you want. Suppose your panel identifiers are in a
string variable called _myunits_, type
encode myunits, gen(myid)
Patrick Joly
[email protected]
[email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/