Hi:
In this program, I want to get every student from SASHELP.CLASS and their age into numbered macro variables. If I don't have AGE on the same SELECT as NAME, there's no guarantee that the names and ages will "match up" -- they might get selected the same way both times, but they might not. The SELECT statement can be optimized to get data and with 2 separate SELECTs, you -could- potentially get the 2 queries returned in 2 different orders. Also, if you do a "select distinct manager", what happens if you have 1 manager for 2 departments?? He or she will show up in the macro variables only 1 time, but don't you want him or her to be in the macro variables twice -- one time for each department row???
cynthia
[pre]
ods listing;
PROC SQL;
select count (name) into :n from sashelp.class;
select name, age into :name1 through :name%left(&n),
:age1 through :age%left(&n)
from sashelp.class;
quit;
** partial display of macro variable values;
%put count= &n;
%put name1 and age1 = &name1 &age1;
%put name2 and age2 = &name2 &age2;
%put name3 and age3 = &name3 &age3;
%put name4 and age4 = &name4 &age4;
%put name5 and age5 = &name5 &age5;
%put name6 and age6 = &name6 &age6;
%put name7 and age7 = &name7 &age7;
%put name8 and age8 = &name8 &age8;
[/pre]