BookmarkSubscribeRSS Feed
teli4a
Calcite | Level 5

Dear  all, I was wondering whether it was possible to use a logical operator to change the title of a plot in a proc gplot?

5 REPLIES 5
PeterClemmensen
Tourmaline | Level 20

what kind of logical operator?

teli4a
Calcite | Level 5

For example:

 

if (condition=true) then title "something";

Quentin
Super User

You should make a little example of the code you want to run.  (e.g. the SGPlot step with some sample data, the condition you want to evaluate, the title statement you want to generate).

 

Assuming you want to conditionally generate a title statement, that usually means using the macro language, e.g.

 

%macro ... ;

  %if &condition %then %do;
    title2 "My Title"; 
  %end;

%mend;

But there are other ways to dynamically generate titles, e.g. in GTL.

 

BASUG is hosting free webinars Next up: Mike Sale presenting Data Warehousing with SAS April 10 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
ballardw
Super User

@teli4a wrote:

For example:

 

if (condition=true) then title "something";


What sets the value of the condition? A manual entry (you for instance), the result of a procedure, a value in a data set?

Can you provide examples of the conditions you want to use. Some may be easier than others. Hint: special characters especially % & ( ) comma may require more coding.

And can you provide some examples of the condition and what you want the title(s) to be.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

If you want the simplest answer, stop using a graphing system that is well out of date.  Read up on proc template and the Graph Template language.  You can pass in the tile as a parameter for instance.  There is a great blog here:

https://blogs.sas.com/content/graphicallyspeaking/

Which has all examples of all types of graphs with loads of code examples.

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 704 views
  • 0 likes
  • 5 in conversation