I need to create two different dummies variables "new and "old from a score range indicator for groups in a panel. Each group is assigned in this dataset a value that ranges from -10 to 10 (the highest level ). In the dataset there are a number of events on specific dates taking place. Frequency is year . My inquire is the following
I first need to separate negative and positive range of the indicator. Then for the positive values of the indicator, I need to separate those groups that had events taking place during the entire sample period for which I have data from those that began having events only within the sample period. For the latter, I need to take observations for the first four events and define those observations as coming from a “new”.
In order to make it clear, I can distinguish between positive and negative values and want two dummies new and old,. What I cannot do is generate the counting (permutation) of events which is neccessery between in order to create old and new,.
New and old are two different dummy variables. New is when the index is positive up to four competitive events and when the index became positive within the sample period for which I have data. Old is when the index is positive for more than four competitive events or when the indicator was positive from the beginning .
A sample of the data is given in the following link bellow.
here #1
https://www.statalist.org/forums/for...-and-frequency
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int Time str15 group float event_date int event_year float event byte index 1974 "Group A" 5434 1974 1 1 1975 "Group A" 5434 1974 0 8 1976 "Group A" 5434 1974 0 8 1977 "Group A" 6533 1977 1 8 1978 "Group A" 6533 1977 0 8 1979 "Group A" 6533 1977 0 8 1980 "Group A" 6533 1977 0 8 1981 "Group A" 7961 1981 1 8 1982 "Group A" 7961 1981 0 8 1983 "Group A" 7961 1981 0 8 1984 "Group A" 7961 1981 0 8 1985 "Group A" 9284 1985 1 8 1986 "Group A" 9284 1985 0 10 1987 "Group A" 9284 1985 0 10 1988 "Group A" 9284 1985 0 10 1989 "Group A" 10901 1989 1 10 1990 "Group A" 11055 1990 1 10 1991 "Group A" 11055 1990 0 10 1992 "Group A" 11055 1990 0 10 1993 "Group A" 12336 1993 1 10 1994 "Group A" 12336 1993 0 10 1995 "Group A" 12336 1993 0 10 1996 "Group A" 13414 1996 1 10 1997 "Group A" 13414 1996 0 10 1998 "Group A" 13414 1996 0 10 1999 "Group A" 13414 1996 0 10 2000 "Group A" 14709 2000 1 10 end format %ty Time format %d event_date
Ps1 I had made a previous thread but thought to recreate in order to make it clear . . Hope I am not breaking nay rules.
Ps2 English is not my first language and might not convey myself well.
0 Response to Dummies on events counting fo panel
Post a Comment