I am regressing a group of variables within a 6-month range from 2004-2022. I want to combine each of these new variables together so it is one large one. The reason I am doing this is they are search terms, so I want to see those that have a negative coefficient (and therefore are most relevant) in that 6 month window.
My current code is this:
I will do this for 6-month increments until 2022. How can I combine each of these together for each word?
My current code is this:
Code:
foreach v of varlist ldiffcost_w_res - ldiffexpense_w_res {
2. regress `v' rmrf if inrange(date, mdy(7, 1, 2004), mdy(12, 31, 2004))
3. predict `v'_h204 if inrange(date, mdy(7,1,2004), mdy(12, 31, 2004))
4. }
