I have the following dataset:
datset_a
obs firm
1 A
2 B
3 C
... ...
For each observation I need to carry out several procedures which I programmed already. So for example, if I take observation 1, after running my program I will obtain a dataset looking like this:
obs firm X Y ....
1 A aaa aav
What I need is a program that takes observation 1, runs the procedures, then goes on to observation 2, runs the procedures, etc. All outputs should then be combined again in a dataset looking like this:
obs firm X Y ....
1 A aaa aav
2 B dfsa dfa
3 C adf dga
I tried using the following code:
%macro match;
%Do i=1 %to 400;
data dataset_a;
set dataset_a;
if nobs ne &i then delete;
data dataset_a1;
merge dataset_a1 b;
by obs;
run;
%end;
%mend match;
%match;
Any idea what is wrong or how I can solve my problem alternatively?
Thanks.