BookmarkSubscribeRSS Feed
laneylaners
Obsidian | Level 7

Any time I export/copy and paste/do anything to do with a graph, the title does NOT go with it. 

 

Below is what happens:

 

blah.png

 

 

 

 

And here is what I want with the title "Total Loaded Mileage" at the top.

Capture.JPG

 

Here is a sample of my code:

goptions htext=15pt;

title h=15pt "Total Loaded Mileage on CN";

proc sgplot data=work.mileage_by_year;

vbar service_year / response=per_mil barwidth=.25 fillattrs=(color=firebrick) nooutline;

xaxis valueattrs=(size=12pt) label="Year" labelattrs=(size=12pt) ;

yaxis valueattrs=(size=12pt) label="Miles in Millions" grid labelattrs=(size=12pt) values=(0 to 2500 by 500);

run;

title;

 

Why isn't the title showing up?

9 REPLIES 9
BrunoMueller
SAS Super FREQ

Hi

 

You have to tell the ODS destination to add the title into the image. How you do this depends on the GUI you are using.

 

But it ends with code similar to the one below. The GTITLE option tells SAS to add the title to the graph

ods html file="c:\temp\with_title.html" gtitle;

title "Some Graph";
proc sgplot data=sashelp.cars;
  vbar type / group=origin;
run;
ods html close;

Bruno

laneylaners
Obsidian | Level 7

i tried this and it didn't work :(.  the html output had no title.

Reeza
Super User

Post your full code and log please. 

Specify gpath on the html statement as well. 

 

 

laneylaners
Obsidian | Level 7

This is my code from the log with the info on when it was run:

 

 

data work.mileage_by_year;

set work.mileage_by_year;

per_mil=sum_of_loaded_miles/1000000;

run;

 

NOTE: There were 10 observations read from the data set WORK.MILEAGE_BY_YEAR.

NOTE: The data set WORK.MILEAGE_BY_YEAR has 10 observations and 3 variables.

NOTE: DATA statement used (Total process time):

real time 0.01 seconds

cpu time 0.00 seconds

 

3 The SAS System 10:04 Tuesday, April 19, 2016

 

 

 

 

ods html path="C:\Users"

gpath="C:\Users\png"

file= "test.htm" gtitle;

NOTE: Writing HTML Body file: test.htm

ERROR: Insufficient authorization to access C:\Users\test.htm.

ERROR: No body file. HTML output will not be created.

goptions htext=15pt;

title h=15pt "Total Loaded Mileage on CN";

proc sgplot data=work.mileage_by_year;

vbar service_year / response=per_mil barwidth=.25 fillattrs=(color=firebrick) nooutline;

xaxis valueattrs=(size=12pt) label="Year" labelattrs=(size=12pt) ;

yaxis valueattrs=(size=12pt) label="Miles in Millions" grid labelattrs=(size=12pt) values=(0 to 2500 by 500);

run;

 

Reeza
Super User

Fix the error in your code first. 

Point it to a path you have access to, most likely a place on server. Or just remove file option and it will default to a location that works. 

laneylaners
Obsidian | Level 7

I'm so sorry, I'm having a really hard time explaining myself.  I want to 'resubmit' a picture to help explain the issue i'm having. 

 

I want to just copy a graph output in SAS, and paste it into any word program.  However, I can only copy the graph, not the title because it's "outside" the graph box.  How do I get the title "inside" the graph box so it all copies as one item?

 

This first image below is what it normally outputs in the results window:

 

blah1.JPG

 

This second image is what I want, where the title is IN the larger border box for the graph (in the circled red space):

blah2.png

 

It seems like every graph I see online for SAS automatically is in the format I'm wanting to get, yet uses the same methodology with using the title statement in the code.

 

Again, I apologize as I'm better at showing things than explaining and hopefully someone can understand my crazy brain.

 

Edit:  here's a random graph I found online from a sas tutorial

blah3.JPG

how does one get the title "Increase of Height with Age" INSIDE the box??

Reeza
Super User

How are you exporting?

 

If you specify the gpath you'll find your file and it should be exactly what you see on screen. 

laneylaners
Obsidian | Level 7

I have SAS Enterprise Guide, but I do all of my work writing the code.  If I try to use EG to export, via an html file, or try to 'send to' an MS document like word/excel/powerpoint, SAS will export the title and graph, but not as 'one' image; the text will often export as a separate text box unassociated with the graph.

 

if i try to use code to export it, and as the user above suggested using 'gtitle', it still only exports the graph (no title) to the destination output.  doesn't matter if it's ODS html, or another kind of output i try.

BrunoMueller
SAS Super FREQ

Hi

 

When using SAS Enterprise Guide, there is a setting to include titles and footnotes within the image.

 

Capture.PNG

 

When using your own code for the ODS destinations. Please ensure, that EG will not create any automatic output.

 

Bruno

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 9 replies
  • 4117 views
  • 1 like
  • 3 in conversation