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 (September 2006, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 5 Sep 2006 15:07:49 +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: Check if macro parameter is empty
Comments: To: yomsas@GMAIL.COM
In-Reply-To:  <6aa258df0609050738l12e3b193t52fc33b30504e291@mail.gmail.com>
Content-Type: text/plain; format=flowed

Yom ,

http://support.sas.com/onlinedoc/913/docMainpage.jsp Go here and learn to use this site.

IF you would have cared to read about the qouting functions before you used them you would have found out that %STR and %NRSTR are both compile time quoting functions. With a few characters difference teh do the same thing at the same time.

Odds are you want the results of %macrolist to be quoted. DO the following:

Ask yourself the following questions:

1.) Is there anything that needs to be qouted?

If the answer is NO then dont worry with quoting at all.

If yes then grab your coolaid and follow me:

2.) When does it need to be quoted, at compile time or execution time?

If the answer is compile time you have two choices: %str and %Nrstr, read up on them and learn teh differences between them.

If it is at execution time then you need to look at %bquote, %nrbquote, %superQ.

3.) What needs to be quoted: commas, quotes ( single or double ), ampers, percent signs, etc....

after you find this out then look for the right function to quote the right character.

If I knew what you were trying to hide from the SAS processor I could help you out a little more. As it stands right now I dont know what you are trying to hide. Is it a quote (single or double) is it a amper or percent sign, is it a comma, or a space? Knowing these little things will make a difference.

Toby Dunn

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 detour.

From: yom <yomsas@GMAIL.COM> Reply-To: yom <yomsas@GMAIL.COM> To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Check if macro parameter is empty Date: Tue, 5 Sep 2006 16:38:16 +0200

Thank you very much for your help ! But if I use %str I get the same error.

Here is the full code :

%macro example;

%macro test(macrolist=); %if %str(&macrolist.) ne %then %do; %Put Not Empty!!! ; %End ; %Else %do ; %Put Empty!!! ; %End ; %mend;

%test(macrolist=%NRSTR(%val(file=aaa)));

%mend;

%example;

2006/9/5, toby dunn <tobydunn@hotmail.com>: > >Yom , > >First off your macro variable will never be empty the way you have it >coded >up: > >%mymacro1(file=&file1,varlist=&varlist1,outfolder=&outfolder1) > >Is always the results. You should learn macros before you jump into using >macro qouting. %Nrstr qoutes the value at compile time not execution time. > > >%Macro Test( AAA = ) ; > >%If ( &AAA = ) %Then %Do ; >%put Empty!!! ; >%End ; >%Else %do ; >%Put Not Empty!!! ; >%End ; >%Mend ; > >%Test( AAA = ) >%Test( AAA = ABCD ) > > > >Toby Dunn > >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 >detour. > > > > > >From: yom <yomsas@GMAIL.COM> >Reply-To: yom <yomsas@GMAIL.COM> >To: SAS-L@LISTSERV.UGA.EDU >Subject: Check if macro parameter is empty >Date: Tue, 5 Sep 2006 15:50:25 +0200 > >Dear All, > >I have this statement : >macrolist=%NRSTR(%mymacro1 >(file=&file1,varlist=&varlist1,outfolder=&outfolder1)); >I would like to test if macrolist is empty or not. >If I use >%if &macrolist. ne %then %do; >...... >%end; >I get this error message : >ERROR: Required operator not found in expression: &macrolist. ne >Please do you know what I have to add ? > >Thank you very much in advance ! > >yom > > >


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