Why do you want/need to create a data set per area code at first place?
This doesn't sound like a good idea.
Anyway, here a possible solution:
Data have;
infile datalines truncover dlm=' ';
input Area_Code Pop Emp;
datalines;
1 50 10
2 100 20
3 150 30
4 200 40
5 250 50
run;
proc sql noprint;
select distinct cats('area_code_',area_code), cat('when(',Area_Code,') output ',cats('area_code_',area_code),';')
into :dslist separated by ' ', :WhenList separated by ' '
from have
;
quit;
data &dslist;
set have;
percent=emp/pop;
select(area_code);
&WhenList
otherwise;
end;
run ;
Message was edited by: Patrick