BookmarkSubscribeRSS Feed
zhuxiaoyan1
Quartz | Level 8

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;

 

 

13 REPLIES 13
Jay54
Meteorite | Level 14

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;

zhuxiaoyan1
Quartz | Level 8

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

Reeza
Super User

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?

DanH_sas
SAS Super FREQ

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

zhuxiaoyan1
Quartz | Level 8

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

 

 

ballardw
Super User

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.

zhuxiaoyan1
Quartz | Level 8

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.

Jay54
Meteorite | Level 14

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.  

zhuxiaoyan1
Quartz | Level 8
Please see the attached graph. Thank you!
Jay54
Meteorite | Level 14

Please post the full code with the options.

zhuxiaoyan1
Quartz | Level 8

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;

Jay54
Meteorite | Level 14

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

zhuxiaoyan1
Quartz | Level 8

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.

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
  • 13 replies
  • 1943 views
  • 0 likes
  • 5 in conversation