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

st: Programing question


From   "Penalva, Fernando" <penalva@iese.edu>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: Programing question
Date   Fri, 11 Apr 2003 23:29:17 +0200

Title: Programing question

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

Fer




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