Date: Fri, 1 Sep 2006 13:44:22 +0000
Reply-To: toby dunn <tobydunn@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: toby dunn <tobydunn@HOTMAIL.COM>
Subject: Re: Sas table Values as macroparameters
Content-Type: text/plain; format=flowed
Problem 1: You didnt enclose the %MacroPrint in single qoutes so as to hide
it from the macro processor. Thus, the macro processor was trying to
resolve it before the data step was compiled and executed. Hence the error
message you were getting.
Now once you do enclose it in single qoutes you have another problem which
is you cant spread even with good syntax a macro call inside of a call
execute over more than one call execute statement. Why? Well when call
execute hits a macro trigger it will pass that information off to the macro
facility. Once there the macro facility will try to resolve any and all
macro code. ( This is an important thing to remember because sometimes it
means that you will want to use single qoutes to stop the macro being used
in the call execute from being executed at the macro execution time and
sometimes you also want to use single qoutes and %nstr to delay the
execution of tyhe macro until after the data step is finished and sometimes
you want the macro to esecute at its normal time). The resulting code is
then passed back to the data step where it is placed on a stack for later
processing. Then it moves on to the next statement and does the same thing.
So in your codes case even if you had done everything right up to that
point the fact that you have the macro call split between two call executes
wont fly the macro facility would get only part of the macro call each time
and wont know what to do with it and throw back an error.
All of this is why I dont recommend call execute not resolve function for
anyone but the master programmers. The sometimes seamingly mind boggling
execution times needs to be kept straight an d you really have to know what
you are doing when using these.
call execute ('%print(file=' || f || "," || "Num=" || Put( N , 8. -L ) ||
")" ) ;
When everything is coming at you all at once, your in the wrong lane.
A truly happy person is someone who can smile and enjoy the scenery on a
From: yom <yomsas@GMAIL.COM>
Reply-To: yom <yomsas@GMAIL.COM>
Subject: Sas table Values as macroparameters
Date: Fri, 1 Sep 2006 09:43:22 +0200
I would like to take values in a sas table so as to be able to use them as
macroparameters. Below is an example of code that I have done so as to do
it. Of course, I have at least 20 parameters. So it is not possible to put
everything in a 'call execute' because it is more than 256 characters.
If I execute this code, I get an error saying that "All positional
parameters must precede keyword parameters".
Normally, I should obtain :
Obs z1 z2
1 a b
2 c d
Please could you help me to correct this code or to find an other
Thank you very much in advance.
input z1 $ z2 $;
proc print data=&file.(obs=&num.);
input f $ n;
call execute ("%macroprint(file="||f||",";
call execute ("num="||n||")");