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 (November 1996, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 12 Nov 1996 11:15:05 PST
Reply-To:     TWB2%Rates%FAR@GO50.COMP.PGE.COM
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         TWB2%Rates%FAR@GO50.COMP.PGE.COM
Subject:      Re: Help with macro and proc tabulate
Comments: To: FEK@LR.DK

So, you defined NR globally using something like: %let NR=10;

Then, inside the macro, you can code: %if &NR=10 %then TITLE='NR=10'; %else %if &NR=8 %then TITLE='NR=8'; %else TITLE="NR=&nr"; ;

There are two tricks here: 1) the semicolons after each TITLE statement are macro semicolons, not base semicolons, so I need a base semicolon at the end, and 2) the first two titles use single quotes which are slightly more efficient but the third title uses double quotes so that &nr will resolve. I could have avoided the first trick by coding: %if &NR=10 %then TITLE='NR=10'%str(;);

The main difficulty in your post was the omission of the % symbols to flag macro keywords.

Tim Berryhill - Contract Programmer and General Wizard TWB2@PGE.COM or http://www.aartwolf.com/twb.html Frequently at Pacific Gas & Electric Co., San Francisco The correlation coefficient between their views and my postings is slightly less than 0 ----------------------[Reply - Original Message]----------------------

Sent by:Fernando Kvistgaard <FEK@LR.DK> I have a global lets say NR In proc tabulate how can I set TITLE = text string depending on NR value? if &NR=10 then TITLE = 'Test'; -------------------- this doesn't work

My macro:

%macro mac_tab; proc tabulate data=data1; class a b; table (a='Ha') all, b='Potatoes'; title '????????'; keylabel N='Group' all='Sum'; %mend mac_tab;

fek@LR.dk

=====================================================================


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