sql4.ppt

Macro variables in SQL
into :variable
Instead of symputx
proc sql noprint ; /* probably no reason */
select sum(stuff) /* or count, max, … */
into :macrovariable
from tablename ;
quit ;
run ;
Instead of repeated symputx
proc sql noprint ; /* probably no reason */
select variable /* */
into :macrovariable1:macrovariable23
/* maybe use
:macrovariable&number*/
from tablename ;
quit ;
run ;
A list of variable names
proc sql ;
select myvariables
into :variablelist separated by “,” /*or “ “*/
from tableofvariables ;
create view/table as
select thisone, &variablelist, thatone
from abigtable where whatever;
quit ;