Date: Sat, 26 Jun 2004 11:17:08 -0400
Reply-To: K*F <kafernan@UWATERLOO.CA>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: K*F <kafernan@UWATERLOO.CA>
Subject: passing in parameters to macro (newbie question)
Content-Type: text/plain; charset="us-ascii"
Can anyone help me trouble shoot the code below?
When I change %rand2(blnum=nk,fileName=test); to
%rand2(blnum=12,fileName=test);, then I get the output I desire (the B
dataset) .but when I keep it as is, it outputs the test dataset, which
is only the nk value and the B table is empty. Do you know how I can
pass in the parameter nk and have the B dataset output like it would if
I passed in a number?
Thanks
Kim
------------------------------------------------------------------------
---------------
%macro analysis (seed=,max_size=,mu=);
data test;
nk=min(&max_size,ranpoi(&seed,&mu));
%rand2(blnum=nk,fileName=test); /* problem line */
run;
%mend;
%analysis (max_size=30,mu=20);
%macro rand2 (blnum=,fileName=);
TITLE 'COMPLETELY RANDOMIZED DESIGN';
DATA A;
DO UNIT=1 TO &blnum;
IF (UNIT <= &blnum/2) THEN TREAT = 1;
ELSE TREAT = 2;
OUTPUT;
END;
PROC PLAN;
FACTORS UNIT=&blnum;
OUTPUT DATA=A OUT=B;
PROC SORT;
BY UNIT;
PROC PRINT;
RUN;
%mend
|