[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
RE: st: creating an unique household identification number
No, I didn't mean that. That would be illegal.
I meant what I said, -group()- with the -label- option.
Note the convention of using - - to indicate literal
Stata code within. Admittedly, the convention of describing
-egen- functions in this way
includes a comma that you don't actually type. In
your case the solution contemplated was
egen newhhid = group(batch_nu hhid_nu), label
except that you confirmed my guess that you have too many
observations for this to work.
Type -help limits- and scroll to -label-. You can't have
3.5 million labels. Thus one of Friedrich's other suggestions
or -egen, concat()- should be nearer the mark.
> Thanks Nick for your contribution. Indeed, I have a big data
> set-3.5 million
> When you suggested using label with egen group (), do you
> mean to use this
> command in the following form?
> egen double newhhid=(batch_nu hhid_nu).
> In addition, -egen, concat()- works either way,
> and even with a combination of numeric and string
> inputs. The result is always string.
> Incidentally, with -egen, group()- you would
> usually like to add the -label- option. However,
> Simo's dataset might be really big, in which
> case -egen, concat()- might offer the better choice.
> > If both variables are numeric you can do this:
> > . gen long id1 = Batch_nu*10 + hhid_nu
> > If both variables are strings you can do this:
> > . gen id2 = Batch_nu + hhid_nu
> > This command works with strings and numeric variables:
> > . egen id3 = group(Batch_nu hhid_nu)
* For searches and help try: