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

st: Odd egen=(max) problem


From   "Hoetker, Glenn" <[email protected]>
To   <[email protected]>
Subject   st: Odd egen=(max) problem
Date   Mon, 2 Jun 2003 13:42:23 -0500

Hi all.  Hoping someone can help me figure out what is up with the
following problem.

I have a data set I've created with "fillin".  It looks like the below.	

patent          str7   %9s                    
appyear         float  %9.0g 

       |  patent   appyear |
       |-------------------|
    1. | 3435154      1965 |
    2. | 3435154         . |
    3. | 3435154         . |
    4. | 3435154         . |
    5. | 3435154         . |  
       |-------------------|
  757. | 3610838      1969 |
  758. | 3610838         . |
  759. | 3610838         . |
  760. | 3610838         . |
  761. | 3610838         . |
       |-------------------|
  
Records 1 and 757 were the "original" records and I wish to repeat the
appyear value from each into all of the copies of each.  I thought I
could do so with

	bysort patent: egen maxappyear=max(appyear)
	replace appyear=maxappyear

However, the egen statement generates 6027 missing entries,
corresponding to 287 unique patents.  One of these is patent 3610838
(line 757 above).  The patent in line 1, on the contrary, worked as
planned.  The data now looks like this: 

     |  patent   appyear   maxapp~r |
       |------------------------------|
    1. | 3435154      1965       1965 |
    2. | 3435154         .       1965 |
    3. | 3435154         .       1965 |
       |------------------------------|
  757. | 3610838      1969          . |
  758. | 3610838         .          . |
  759. | 3610838         .          . |

I can find nothing in common among the patents that are not working.
Trying the same routine with another variable and it works just fine.  

Can anyone figure out what might be going on here or suggest an
alternative?

Thanks.

Glenn
 
Glenn Hoetker
Assistant Professor of Strategy
College of Business Administration
University of Illinois at Urbana-Champaign
217-265-4081
[email protected]
"Success is going from failure to failure without a loss of enthusiasm."
Sir Winston Churchill 

*
*   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/



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