- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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:
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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'
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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'
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;