Here is one of the ways to "split" data that way.
Note, no macro needed at this stage though writing 20 outputs like this does take a small amount of time:
data patient;
input Name $ income visit Spend ;
datalines;
Alex 100 10.45 10.20
Bruce 200 2.51 50.21
Candy 150 5.21 15.21
;
data Alex
Bruce
Candy
;
set patient;
select (name);
when ("Alex") output Alex;
when ("Bruce") output Bruce;
when ("Candy") output Candy;
otherwise ;
end;
run;
But really, how do you intend to use those 20 data sets?
If you want to do analysis on a subset of the data you can use WHERE to restrict it to specific names:
proc means data=patient;
where name in ('Alex' 'Candy');
var income spend;
run;
... View more