Data visualization with SAS programming

SAS 9.2 - Frequency Histograms

Not applicable
Posts: 1

SAS 9.2 - Frequency Histograms

Bear with me as I am new to SAS and I'm assuming this is not a complicated question!

Using this code:

sgpanel data=histogram_data noautolegend;

     title "PW Distribution by Concentration and Acceptance";

     panelby accept concen / columns=2 rows=3 layout=lattice;

     histogram prowid;


     Label Prowid='Pronotum Width';

     Label concen='Concentration (%)';

     Label accept='Acceptance';


I'm just trying to change the y axis from the default percent scale to frequency. When I try to use scale=count code it tells me it is out of order.

Any help out there?


Posts: 1,289

Re: SAS 9.2 - Frequency Histograms

First, in general it is easier to help if you supply a full working program (with data) that can be run to produce a graph.  You can use one of the data sets in SASHELP to illustrate your issue.  It also helps to know the release of SAS you are using (9.2, 9.3, etc.).  I assume you left out the "proc" by error.

Having said that, with SAS 9.3 or higher release, you can use SCALE=count to get what you want.  I do not have access to SAS 9.2 right now, but if you do, you can try this code.

proc sgpanel noautolegend;

     title "PW Distribution by Concentration and Acceptance";

     panelby origin drivetrain / columns=3 rows=3 layout=lattice;

     histogram mpg_city / scale=count;


Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation