|
Dear Renata,
You are making the classical mistake of thinking tha macro code is
interpreted and runs where it is called within SAS code. Nothing is less
true. Your macro Amostra runs already _before_ the PROC IML code. It does
not assign the calculated value of IML variable Quantidade to the macro
variable Quantidade, but just the text 'quantidade' (without the quotes)
itself. If it concerned a SAS data step (can't you use that?) I would
recommend calling the macro from a CALL EXECUTE statement.
But like David C. already suggested: your code possibly can be corrected and
reduced if you tell us what you are trying to do at the higher level.
Regards - Jim.
--
Jim Groeneveld, Netherlands
Statistician, SAS consultant
home.hccnet.nl/jim.groeneveld
On Tue, 17 Oct 2006 22:52:39 -0200, Renata Matos <renata_matos@YAHOO.COM.BR>
wrote:
>Here's what I'm trying to do:
>
>%macro amostra(banco,quantidade,tamanho);
>proc surveyselect data=&banco out=amostra rep=&quantidade sampsize=&tamanho
noprint;
>run;
>proc print data=amostra;
>run;
>%mend amostra;
>
>%macro teste(banco,k);
>%nobscat(&banco);
>proc iml;
>/* #observations */
>use nobs;
>read all into n;
>close nobs;
>print n;
>/* samples*/
>ji=0.1*(n/&k);
>js=0.5*(n/&k);
>quantidade=int((ji+js)/2)+1;
>print ji js quantidade;
>/* HERE'S THE PROBLEM! */
>%amostra(&banco,quantidade,5);
>%mend teste;
>
>%teste(refin,2);
>run;
>quit;
>
>Here's the Log:
>NOTE: Line generated by the invoked macro "AMOSTRA".
>1 proc surveyselect data=&banco out=amostra rep=&quantidade
sampsize=&tamanho noprint;
>--------
>202
>1 ! run; proc print data=amostra; run;
>ERROR 202-322: The option or parameter is not recognized and will be ignored.
>NOTE: Line generated by the macro variable "QUANTIDADE".
>1 quantidade
>----------
>22
>ERROR 22-322: Expecting an integer constant.
>
>Thanks for any help.
>Renata Matos
[removed all intermediate empty lines]
|