assuming the sort order you want matches the text of your request:
. bys Customer PkgNo occurrence: gen ID=PkgNo[1]
see -help bysort- for more.
On 2/7/06, [email protected] <[email protected]> wrote:
> Hello All,
>
> I have a dataset like the following and need to create a new variable
> (identifier) based on the value of the occurrence. The data set is by
> pkgNo and customer.
*
* 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/