we have 2 datasets: dataset 1: for each id1-id2 pair, inter_id have so many values dataset 2: for each id2-inter_id pair, y and x can have so many values final we want b for each id1-id2 pair: e.g. b_AM is calculated by regressing y on x using (K1+K2+K3) observations
So what does b_AM equal in the first obs?
I'm not following the need for a macro. If you do the merge, then you can do all the regressions with a BY statement.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.