Hi,
Trying to figure out how do I add titles to my 3 variables?
Below is my code:
ods graphics on;
proc univariate data=ford_2015 plot;
var city08 fuelcost08 displ;
histogram / normal odstitle = "City MPG for 2015 Fords"
"Annual Fuel cost for 2015 Fords""Engine Displacement in ltrs for 2015 Fords";
label city08 = "City MPG";
label fuelcost08 ="Annual Fuel cost";
label displ="Displacement in ltrs";
run;
upon running this code I get the following error:
I am not sure exactly what you want for the title but you can use the \l to use the label of a variable as part of the title. If you don't provide any other string then the variable label is all that would appear.
ods graphics on; proc univariate data=sashelp.class ; var age height weight; histogram / normal odstitle='\l'; label age ='Age at enrollment' height= 'Height at graduation' weight= 'Weight at lunch' ; run; title; ods graphics off;
If you want the same text to appear at the end of the "title" then use
odstitle ='\l for 2015 Fords'
I am not sure exactly what you want for the title but you can use the \l to use the label of a variable as part of the title. If you don't provide any other string then the variable label is all that would appear.
ods graphics on; proc univariate data=sashelp.class ; var age height weight; histogram / normal odstitle='\l'; label age ='Age at enrollment' height= 'Height at graduation' weight= 'Weight at lunch' ; run; title; ods graphics off;
If you want the same text to appear at the end of the "title" then use
odstitle ='\l for 2015 Fords'
Put your data into long format and use by-processing with #byval substitution in the title. Example:
data graph;
set sashelp.cars;
where make = "Ford";
value = EngineSize; parameter = "Engine Size"; output;
value = HorsePower; parameter = "Horse Power"; output;
value = Length; parameter = "Length"; output;
keep type parameter value;
run;
proc sort data=graph; by parameter; run;
title2 "Parameter = #BYVAL1";
proc univariate data=graph;
var value;
by parameter;
histogram / normal odstitle = "Ford Models" odstitle2=title2;
run;
Try using multiple HISTOGRAM statement ?
proc univariate data=sashelp.class ;
var age height weight;
histogram age/ normal odstitle='age';
histogram height/ normal odstitle='height';
histogram weight/ normal odstitle='weight';
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.