Question

SAS - I want to set the title of my chart to a specific cell value, say the first observation of my Rate_ID column. How could I do this?

Was it helpful?

Solution

If as @Robert Penridge suggests, you're using a SAS procedure which uses title statements for titling, use SAS Macro:

data _NULL_;
  set my_dataset (obs=1 keep=rate_id);
  call symputx('mytitle',rate_id);
run;

title "&mytitle.";
/* Insert chart code below */

This code gets the first observation from your dataset and sets up a macro variable called mytitle containing the value of rate_id for that observation. Then you can pass the value to the title statement.

I've used obs=1 to restrict to one observation, and keep=rate_id to improve efficiency if you're dealing with a dataset with lots of columns. Also, call symputx will trim the value of rate_id, removing all leading and trailing whitespace from the resulting macro variable.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top