LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (June 2004, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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


Back to: Top of message | Previous page | Main SAS-L page