DATA Step, Macro, Functions and more

Macros and Multiple inputs

Reply
Contributor
Posts: 58

Macros and Multiple inputs

I am very new to Macros and  I have a quick question.. How do I input in two variables in a macro?

%MACRO Table2adj (exp=);

PROC SURVEYLOGISTIC DATA =temp nomcar;

STRATA sdmvstra;

CLUSTER sdmvpsu;

WEIGHT MEC10YR;

DOMAIN sel;

CLASS &exp (REF='0') agegp (ref='3.30-39') martial (REF='4.never married') race (REF='1.NH White') edu (REF='HS') employ (REF='0')

income (REF='55+') healthstatus (REF='good')  alcohol_abuse (REF='1.Low/No Risk') smoke (REF='0.never smoke')  drug (REF='0');

MODEL haveins (event='1')= &exp agegp martial race edu employ income healthstatus Charlston_Score

/clparm vadjust=none;

run;

PROC SURVEYLOGISTIC DATA =temp nomcar;

STRATA sdmvstra;

CLUSTER sdmvpsu;

WEIGHT MEC10YR;

DOMAIN sel;

CLASS &exp (REF='0') agegp (ref='3.30-39') martial (REF='4.never married') race (REF='1.NH White') edu (REF='HS') employ (REF='0')

income (REF='55+') healthstatus (REF='good')  alcohol_abuse (REF='1.Low/No Risk') smoke (REF='0.never smoke')  drug (REF='0');

MODEL healthvisit (event='1')= &exp agegp martial race edu employ income healthstatus Charlston_Score

/clparm vadjust=none;

run;

%MEND Table2adj;

%Table2adj(exp=Male);

So the code above,  I inserted the variable Male for &exp.. The two proc surveylogistic are identical with exception of the outcome. So I am wondering is there a way to insert Male and insert healthvisit? This is a simplified example, I have multiple procs to run.

Super User
Posts: 5,256

Re: Macros and Multiple inputs

If you want them in the same execution, just line them up in the macro call separated by space (as they would in the proc logic.

If you want separate executions, just call the macro twice and changing the parameter.

Data never sleeps
Ask a Question
Discussion stats
  • 1 reply
  • 161 views
  • 0 likes
  • 2 in conversation