06-22-2015 05:24 PM
%macro eye (eye,dat, id);
data adae ;
if STUDYGR1 ='Y' and AECAT=&eye and TRTEMFL='Y' and AEBODSYS ne '' 1 ; *'Ocular';
proc sql ;
/*Number of subjects TRTAN */
create table any as select trtan, count(distinct usubjid) as cnt from adae where trtan ne . group by trtan;
create table soc as select AEBODSYS,trtan, count(distinct usubjid) as cnt from adae where trtan ne . group by AEBODSYS,trtan;
create table pt as select AEDECOD, AEBODSYS, trtan, count(distinct usubjid) as cnt from adae where trtan ne . group by AEDECOD,AEBODSYS,trtan;
The where condition(in red color) needs to be modified for each table.
Eg: where ethnicity="Hispanic"
where ethnicity="Not Hispanic"
I need to pass all these where conditions in one program.How can i do that?
09-11-2015 10:39 AM
Change the macro to have an additional parameter COND
Create a data set will the parameters you need to call the macro and use call execute
%macro eye (eye,dat, id, cond);
Your PROC SQL tables will get overwritten with each run though as they will all have the same name.
My example of call execute:
SAS Documentation example for call execute: