BookmarkSubscribeRSS Feed
roroholic123
Calcite | Level 5

Hello,

 

I am trying to generate a figure displaying the percent distribution of a variable (y-axis) over the number of weeks (x-axis). Here is the code I used:

 

PROC FREQ DATA=sample;
TABLES weeks / plots=FreqPlot(scale=percent);/* Graph the percentage of "weeks" */
TITLE "Figure 1 The Proportional Distribution of weeks";
RUN;

 

The returned graph looks perfect for what I wanted. But my questions are:

1. How to export only the graph? The output also includes a freq table.

2. How to add a legend to this graph?

3. How to change the labels on both axes?

4. How to change the title of this graph? Currently the title is "Distributions of weeks" and I would like to change it to "Figure 1...".

1 REPLY 1
PaigeMiller
Diamond | Level 26

@roroholic123 wrote:

Hello,

 

I am trying to generate a figure displaying the percent distribution of a variable (y-axis) over the number of weeks (x-axis). Here is the code I used:

 

PROC FREQ DATA=sample;
TABLES weeks / plots=FreqPlot(scale=percent);/* Graph the percentage of "weeks" */
TITLE "Figure 1 The Proportional Distribution of weeks";
RUN;

 

The returned graph looks perfect for what I wanted. But my questions are:

1. How to export only the graph? The output also includes a freq table.

2. How to add a legend to this graph?

3. How to change the labels on both axes?

4. How to change the title of this graph? Currently the title is "Distributions of weeks" and I would like to change it to "Figure 1...".


  1. Use ODS to turn off parts of the output you don't want.
    ods exclude onewayfreqs;
  2. What do you mean by "legend"?
  3. The LABEL statement in PROC FREQ will let you change the horizontal axis label. I don't think you can change the vertical axis label (unless you modify a template somewhere)
  4. Change the TITLE statement.
--
Paige Miller

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 3306 views
  • 0 likes
  • 2 in conversation