Date: Wed, 26 Feb 2003 13:09:24 -0800
Reply-To: cassell.david@EPAMAIL.EPA.GOV
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "David L. Cassell" <cassell.david@EPAMAIL.EPA.GOV>
Subject: Re: combinations using two macro variable lists
Content-type: text/plain; charset=us-ascii
Joseph Schuchter <joeschuc@HOTMAIL.COM> wrote [in part]:
> %macro correlation;
>
> %do i=1 %to &numouts;
> %do i=1 %to &numexps;
>
> %let outcome=%scan(&outlist,&i,' ');
> %let exposure=%scan(&explist,&i,' ');
>
> * calculating correlation coefficients;
> proc corr data=&dataset PEARSON SPEARMAN;
> var &exposure &outcome;
> run;
>
> %end;
> %end;
>
> %mend;
>
> However, what I get are: outcomeA*exposureA, outcomeB*exposureB,
> outcomeC*exposureC (breathing&aqi asthma&o3_avg chronb&pm_avg). What I
> want is all combinations/iterations outA*expA, outA*expB, outA*expC,
> outB*expA, etc..
Ron Fehd gave you an excellent answer to your problem (as always!), but
I
have a completely different suggestion. Rather than use a macro to
generate
all the corelations you're interested in, why not use the internal
facilities
of PROC CORR ? Try replacing your entire macro with the following code:
proc corr data=&dataset PEARSON SPEARMAN;
var &exposure;
with &outcome;
run;
This will give you tables of corelations of all the exposure vs. outcome
combinations. You can manipulate the tables of correlations using the
PROC CORR output data sets, or else ODS to grab the tables as SAS data
sets.
HTH,
David
--
David Cassell, CSC
Cassell.David@epa.gov
Senior computing specialist
mathematical statistician
|