Hi
Being absolutely new in SAS I got confused with the TAG in the following construction. I assume that this is a conditional loop. However I wonder what is the role of TAG? I tried to find it in help-on-line …but failed. Could you please explain me? Thank you in advance
Rina
data data1 data2 data3;
set mydata;
if (condition) then do;
tag=1;
output data1;
end;
else if (condition2) then do;
tag=2;
output data2;
end;
else if (condition3) then do;
tag=3;
output data3;
end;
run;
/* after that there are sorting of each data1,2,3 by id*/
data data1_3;
set data1 data2 data3 ;
run;
proc sort data=data1_3;
by id tag;
data final (drop=tag);
set data1_3;
by id tag;
if first.id;
run;
Being absolutely new in SAS I got confused with the TAG in the following construction. I assume that this is a conditional loop. However I wonder what is the role of TAG? I tried to find it in help-on-line …but failed. Could you please explain me? Thank you in advance
Rina
data data1 data2 data3;
set mydata;
if (condition) then do;
tag=1;
output data1;
end;
else if (condition2) then do;
tag=2;
output data2;
end;
else if (condition3) then do;
tag=3;
output data3;
end;
run;
/* after that there are sorting of each data1,2,3 by id*/
data data1_3;
set data1 data2 data3 ;
run;
proc sort data=data1_3;
by id tag;
data final (drop=tag);
set data1_3;
by id tag;
if first.id;
run;