Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Help with the record( ) function


From   Jeff Simonson <[email protected]>
To   [email protected]
Subject   st: Help with the record( ) function
Date   Fri, 24 Aug 2007 09:16:56 -0700 (PDT)

Ultimately, what I want to do is sort through my observations and pick out
a minimum and maximum for each group and then have that value as a
constant in a new variable. I am working through Baum's book An
Introduction to Modern Econometrics using Stata 
and came across page 33 where the author explains use of the record()
function. The command and function used in the book is:

egen hiwage = record(wage), by(empid) order(year)

I am running Stata9 and entered in a simple set of data to test the
function.

. list

     +-------------------+
     | sid   term    gpa |
     |-------------------|
  1. |   1    F01   1.08 |
  2. |   1    F02    3.1 |
  3. |   1    F03   3.96 |
  4. |   1    F04   1.35 |
  5. |   1    F05   2.87 |
     |-------------------|
  6. |   2    F02   2.26 |
  7. |   2    F03   2.63 |
  8. |   2    F04   3.49 |
  9. |   2    F05   3.94 |
     +-------------------+

So I figured that the record() function used in conjunction with the
egen command would give me the highest gpa for the student (sid).
Here is my command and output.

. egen highgpa = record(gpa), by(sid)
unrecognized command:  _grecord
r(199);

Any help would be appreciated.

Thanks,
Jeff


       
____________________________________________________________________________________
Yahoo! oneSearch: Finally, mobile search 
that gives answers, not web links. 
http://mobile.yahoo.com/mobileweb/onesearch?refer=1ONXIC

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