| Date: | Wed, 5 Apr 2006 16:44:29 -0700 |
| Reply-To: | tanwan <tanwanzang@YAHOO.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | tanwan <tanwanzang@YAHOO.COM> |
| Organization: | http://groups.google.com |
| Subject: | Re: PROC FREQ syntax question |
|
| In-Reply-To: | <1115a2b00604051249s55756378y18d5ba9cbc2b1b97@mail.gmail.com> |
| Content-Type: | text/plain; charset="iso-8859-1" |
|---|
The following macro will do what you want and more: it should handle
any number of variables on the list, NOT only 4.
%macro relist(variableList);
%let thend = %sysfunc(countc(&variableList,' '));
%let thend = %eval(&thend+1);
%do qq=1 %to &thend;
%let v1=%qscan(&variableList, &qq);
%do zz = %eval(&qq+1) %to &thend;
%let v2=%qscan(&variableList, &zz);
&v1 * &v2
%end;
%end;
%mend relist;
proc freq data=SASHELP.CLASS;
tables %relist(AGE HEIGHT NAME WEIGHT)
/ norow nocol nopercent;
run;
|