|From||"Penalva, Fernando" <firstname.lastname@example.org>|
|Subject||st: Programing question|
|Date||Fri, 11 Apr 2003 23:29:17 +0200|
I need to program a function or macro that does the following:
I have two datasets: Dataset1 contains two variables: FIRMID (numeric format) and ENDDATE (date format YYYMMDD). Dataset2 contains four variables: FIRMID (numeric format), DATE (date format YYYYMMDD) Y and X.
I want to add a new variable, COEFF, to each observation in Dataset1. To create COEFF, I have to take observations in Dataset2 with the same FIRMID, and DATE between (ENDATE minus 2 years) and ENDATE. With the selected observations I will regress Y on X. COEFF will be the coefficient on the X variable.
Can anyone help me? Thanks