Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re:

From   "Ezell, Mike" <>
Subject   st: Re:
Date   Thu, 13 Feb 2003 16:38:58 -0600


This should do it for you:

bysort name: gen tmpfirst=(_n==1)
gen idint=sum(tmpfirst)
drop tmpfirst

If you want the number of records per case:
bysort idint: gen totrecs=(_N)


Michael E. Ezell, Ph.D.
Assistant Professor
Department of Sociology
Vanderbilt University

--On Thursday, February 13, 2003 2:28 PM -0800 Thomas Heckelei <> wrote:


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?

Thanks for your help, Thomas

Thomas Heckelei PhD
Assistant Professor, IMPACT Center and
Department of Agricultural and Resource Economics
Washington State University

123C Hulbert Hall
PO Box 646214, Pullman WA 99164-6214
Fax: 509-335-3958

*   For searches and help try:

*   For searches and help try:

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