Data visualization with SAS programming

SAS Graph

Reply
Contributor
Posts: 65

SAS Graph

This is part of my data:

PAP    AVG_OF_ALLWD_ADJ

51548 7387.4292664
55003 7692.9721846
5SS53 7706.8575189
5H981 7767.2836185
5J130 7921.2581873
5K556 8024.3621929
5K941 8228.2977649
54227 8340.3338716
5H164 8530.2252328
52669 8579.2874546
5J977 8580.4548783
5J416 8605.556626
50383 8626.09073
5I008 8711.7346734

 

I use this code to get a graph. I need to resize my graph in some situatitaons. For example, I want to resize the graph in word or powerpoint. Sometimes I need it to be tall, and sometiomes I need it to be wide. But after I resize the graph, the label also changed accordingly. How can I change the size of the graph without changing the size of labels (the size of the text)? Thanks!

proc sgplot data=For_Fig;

band x=pap lower=0 upper=Avg_of_ALLWD_ADJ;

yaxis values=(0 to 2000 by 14000) label ='AVERAGE AMOUNT';

xaxis display=(noticks novalues);

refline 9190 9795 10870 /transparency=0.5

label=('Gain Share Limit=$9190' 'Commendable=$9795' 'Acceptable=$10870');

run; quit;

 

 

SAS Super FREQ
Posts: 1,078

Re: SAS Graph

[ Edited ]

How are you resizing your graph for your needs?  It is preferable to use the WIDTH= and HEIGHT= options on the ODS GRAPHICS statement.  This will create a graph that maintain your fonts, etc.

 

ods graphics / reset width=4in height=3in;

proc sgplot data=For_Fig;

band x=pap lower=0 upper=Avg_of_ALLWD_ADJ;

yaxis values=(0 to 2000 by 14000) label ='AVERAGE AMOUNT';

xaxis display=(noticks novalues);

refline 9190 9795 10870 /transparency=0.5

label=('Gain Share Limit=$9190' 'Commendable=$9795' 'Acceptable=$10870');

run; quit;

Contributor
Posts: 65

Re: SAS Graph

thank you for the help, but this does not work. After I resize the graph, the size of the font still change.

Grand Advisor
Posts: 17,313

Re: SAS Graph

What format is your graphic file? Have you tried an SVG\EMF file?

 

Right now, the only way I can think of is to create the files that are 'separatable' that allows you to decompose to the parts and then you increase the size you need for the relevant sections. 

 

Your best bet is to create the graphs with the sizes you need directly from SAS specifying height/width. 

 

What happens if you output graphs using ODS EXCEL? Do those scale properly?

SAS Super FREQ
Posts: 888

Re: SAS Graph

In addition to what Sanjay told you, also try adding the NOSCALE option to the ODS GRAPHICS statement and see if you gives what you want.

 

Hope this helps!
Dan

Contributor
Posts: 65

Re: SAS Graph

The option noscale did not work either. Thank you anyway!

 

 

Grand Advisor
Posts: 10,196

Re: SAS Graph

Which active ODS destination are you sending the output to? Since you did not mention a specific ODS output I suspect HTML which would mean the individual graphics created are PNG.

 

You also have not mentioned how you are placing the images into the PowerPoint. If copy and paste then you are likely pasting a PNG image which does not behave well when "resizing" as PNG is not intended for scaling.

Contributor
Posts: 65

Re: SAS Graph

My SAS version is 9.3. ODS excel did not work for me. Yes, I think it's PNG I copy and paste into excel and word. My boss wants to put it into powerpoint. He can't code. He just needs the graph and then he can put wherever he wants.

SAS Super FREQ
Posts: 1,078

Re: SAS Graph

[ Edited ]

It is not clear what you are expecting or getting without any results we can view.  If you are resizing the resulting graph image to a size different from the original, clearly everything will scale, including the font.   So you should render the graph to the exact size you want to put in the document.  

 

Please post the full code and graphs output with the options that you have used.  

Contributor
Posts: 65

Re: SAS Graph

Please see the attached graph. Thank you!
SAS Super FREQ
Posts: 1,078

Re: SAS Graph

Please post the full code with the options.

Contributor
Posts: 65

Re: SAS Graph

ods graphics/noborder noscale;

proc sgplot data=have;

band x=pap lower=0 upper=AVG;

yaxis values=(0 to 35000 by 5000);

label Avg='Avg Amount';

xaxis display=(noticks novalues);

refline 20950 25234 26374 /transparency=0.5

label=('Gain Share Limit=$20950' 'Commendable=$25234' 'Acceptable=$26374');

run;

SAS Super FREQ
Posts: 1,078

Re: SAS Graph

When I run your code, I get the following output:

GraphSize_1.png

 

If I use "ods graphics/reset noborder width=4in height=3in;", I get the following:

GraphSize_2.png

Contributor
Posts: 65

Re: SAS Graph

Yes, I know that. But neither one of them is what my boss wants. He dose not want the fixed size of graph. He will resize it in the way he wants and wants to keep the label same size. the size of the graph will change but the label will be the same.

Ask a Question
Discussion stats
  • 13 replies
  • 276 views
  • 0 likes
  • 5 in conversation