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 (October 2006, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 18 Oct 2006 03:57:50 -0400
Reply-To:   Jim Groeneveld <jim2stat@YAHOO.CO.UK>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Jim Groeneveld <jim2stat@YAHOO.CO.UK>
Subject:   Re: Macro + Surveyselect
Comments:   To: Renata Matos <renata_matos@YAHOO.COM.BR>

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]


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