Data visualization with SAS programming

Export editable graphs via SAS Studio

Reply
Occasional Contributor
Posts: 5

Export editable graphs via SAS Studio

[ Edited ]

I have created my graphs, however, I want to customize them.  However, when I have attempted the save as HTML open in Excel I get the "red box of death" where the graphs should be.  (That code is below.)  I then attempted the ODS Excel but I get the error message: 

 
ERROR: Insufficient authorization to access /pbr/biconfig/940/Lev1/SASApp/sasexcl.xlsx.
 
I do not want to recreate these graphs by hand.  What do I need to do to be able to export them into something (anything at this point) which I can adjust colors/fonts, etc for use in my Master's Capstone project.  I have exported the RTF file, but it exported the graphs as pictures which means I still can't edit them.  Help?
 
**EDIT: Code below**
 
Data vpp;
Set homework.vpp;
run;
ODS graphics;
proc univariate data=homework.vpp normal mu0=12;
var Correct_before;
histogram Correct_before/normal;
run;
ODS graphics off;
ODS graphics;
proc univariate data=homework.vpp normal mu0=12;
var Correct_after;
histogram Correct_after/normal;
run;
ODS graphics off;
ODS graphics;
proc univariate data=homework.vpp normal;
var Difference_Correct;
histogram Difference_Correct/normal;
run;
ODS graphics off;
proc univariate data=homework.vpp mu0=6;
var Difference_Correct;
run;
 
Super User
Posts: 11,114

Re: Export editable graphs via SAS Studio

Generally I adust colors and appearance with SAS code but you haven't shown any so it is hard to tell what may be appropriate.

 

The ODS Graphics statement options OUTPUTFMT controls the image type.

The specific option varies with the ods destination. For RTF use something like

 

ODS graphics/ outputfmt=EMF;

ods rtf file="path and file" <other destination options>;

<code to generate plots>

ods rtf close;

 

Html output by default should generate PNG files, likely in your work library location. Depending on where that is Excel may not find them as there are number of things going on singe images in HTML are displayed referenced files and depending on how you display the html in Excel it may not see the referenced location.

 

That error message looks like you aren't specifing where the output goes and is possibly attempting to write to a location on a server where you do not have access. But again without code it is hard to tell.

Occasional Contributor
Posts: 5

Re: Export editable graphs via SAS Studio

I updated it with the code.  Sorry about that.  I also tried doing the ODS graphics vice the ODS Excel to see if that would make a difference (it didn't).  

Super User
Posts: 19,058

Re: Export editable graphs via SAS Studio

There is a post on her from a day or two ago that explains this. It needs a workaround which may or may not work in SAS UE. 

Feel free to post your code and explain what youre trying to change and we can help you accomplish it via code. 

Occasional Contributor
Posts: 5

Re: Export editable graphs via SAS Studio

The code is now in the original respose.  I'm trying to edit/update both of the graphs. I want to take out the underscore in the labels (title and axis), I want to change the colors from the current baby blue to a dark blue with the curve being orange or yellow whichever looks better against the darker columns. 

 

 

Super User
Posts: 19,058

Re: Export editable graphs via SAS Studio

Apply labels to your variables to get the underscore removed.

 

ie

 

 

label my_variable = 'My Variable Name';

 

Unfortunately editing graphs from the procedures is not as straightforward. If you used SGPLOT it's ...

 

Instructions are here on how to create editable graphs are linked above. My computer is misbehaving and I can't post a direct link.

 

 

 

Occasional Contributor
Posts: 5

Re: Export editable graphs via SAS Studio

That changed the label on the axis, but not on the title? 

Super User
Posts: 19,058

Re: Export editable graphs via SAS Studio

Here's what I think the equivalent code would be for SGPLOT with examples of how you'd change the colors, labels and titles.

Note I used Hex codes to select the colours and in SAS you add CX in front. So get the hex colour you want and update the code as desired.

 

title 'My Histogram';
proc sgplot data=sashelp.class;
histogram height /  dataskin=none outline fill fillatrs=(color=CX00aad2);
density height / lineattrs=(color=Cxedb700) ;
label height='Height (inches)';
run;
Ask a Question
Discussion stats
  • 7 replies
  • 148 views
  • 0 likes
  • 3 in conversation