Hello,
I am using panel data with individuals that are identified by an identification number which is listed under the variable "Pidm", and the fiscal years in which they made donations. There are multiple rows per unique Pidm and per year they donated.
I am trying to have Stata go through all gifts for each unique Pidm, as defined by group numbers, and then copy the largest gift they ever made to a new variable called "Largest_Gift". There are over 400,000 unique Pidms.
I normally use the levelsof command to run loops on each value of a variable, but when I try to do levelsof group I get this error message:
Example of dataset)
dataex PPidm pidm_group FISCALYEAR FiscalYearGifts, count(10)
----------------------- copy starting from the next line -----------------------
I am using panel data with individuals that are identified by an identification number which is listed under the variable "Pidm", and the fiscal years in which they made donations. There are multiple rows per unique Pidm and per year they donated.
- Eg. If an individual donated in fiscal years 2017 and 2018, they will have two rows, both with the same Pidm, but with the two donation amounts.
I am trying to have Stata go through all gifts for each unique Pidm, as defined by group numbers, and then copy the largest gift they ever made to a new variable called "Largest_Gift". There are over 400,000 unique Pidms.
I normally use the levelsof command to run loops on each value of a variable, but when I try to do levelsof group I get this error message:
Example of dataset)
dataex PPidm pidm_group FISCALYEAR FiscalYearGifts, count(10)
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long PPidm float(pidm_group FISCALYEAR) double FiscalYearGifts 70004534 1 . . 70004536 2 . . 70004537 3 . . 70004538 4 . . 70004539 5 2002 1965 70004539 5 2003 125 70004542 6 . . 70004544 7 . . 70004546 8 2007 88 70004546 8 2010 45 end format %ty FISCALYEAR
Comment