Data visualization with SAS programming

SGPANEL: Different categories in each panel

Reply
Occasional Contributor
Posts: 5

SGPANEL: Different categories in each panel

I am running the following code to create several horizontal bar charts:

 

proc sgpanel data=mydata;

panelby by panelvar;

hbarparm category=catvar response=size;

run;

 

The problem I run into is that each of my panelvar values has differet catvar values. SGPANEL produces horizontal bar charts with bars for every category in the data set in each panel. In each panel, I really just want to see bars for categories that exists for that panelvar value.

 

Is there a way to do this with PROC SGPANEL or do I have to use PROC SGPLOT with a BY statement?

Respected Advisor
Posts: 4,606

Re: SGPANEL: Different categories in each panel

Try option UNISCALE=ROW in the PANELBY statement.

PG
Occasional Contributor
Posts: 5

Re: SGPANEL: Different categories in each panel

Unfortunately, that doesn't do quite what I'm looking for. Here is a code example that uses sashelp.cars:

 

proc sgpanel data=sashelp.cars (where=(Make like 'A%'));

panelby make / columns=1 uniscale=row;

hbarparm category=model response=MPG_City;

run;

 

I'd like to make it so only the models for Audi show up in the Audi panel, only the models for Acura in the Acura panel, etc.

Respected Advisor
Posts: 4,606

Re: SGPANEL: Different categories in each panel

Smiley Frustrated I always mix those up! You need  UNISCALE=COLUMN !

PG
Occasional Contributor
Posts: 5

Re: SGPANEL: Different categories in each panel

Great! That worked. Thanks so much.

SAS Super FREQ
Posts: 1,042

Re: SGPANEL: Different categories in each panel

With SAS 9.4, you can use the PROPORTIONAL option to make all bars the same thickness regardless of the number in each cell.

 

proc sgpanel data=sashelp.cars (where=(Make like 'A%'));
  panelby make / columns=1 uniscale=column proportional;
  hbarparm category=model response=MPG_City;
run;

 

CarsPanel.png

Post a Question
Discussion Stats
  • 5 replies
  • 369 views
  • 1 like
  • 3 in conversation