BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Gick
Pyrite | Level 9

Hi,

I have 3 variables each having 4 modalities. I would like to represent their histogram aligned along the abscissas in the same graph to visualize. What option or instruction does this?

Thank you
Gick

PROC GCHART data=data;
HBAR symptomes_viraux symptomes_vir_douloureux Maladie_respiratoire  /ascending outside=percent;
RUN ;
QUIT;

 

here is the example

picture_SAS.PNG 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Here are two options. The simplest way is to use PROC SGPLOT, but PROC SGPANEL has some options for paneling the data that might be useful:

data Have;
length Symptoms $16 Group $3;
input Symptoms Group Percent;
datalines;
viraux         A 58
viraux         B 20
viraux         C 12
viraux         D 10
vir_douloureux A 64
vir_douloureux B 25
vir_douloureux C 9
vir_douloureux D 2
respiratoire   A 57
respiratoire   B 23
respiratoire   C 14
respiratoire   D 6
;

title "An SGPLOT Example";
proc sgplot data=Have;
   hbar Symptoms / response=Percent group=Group groupdisplay=cluster 
        datalabel datalabelpos=data grouporder=descending;
   xaxis grid label="Percent";
   yaxis reverse;
run;

title "An SGPANEL Example";
proc sgpanel data=Have noautolegend;
   panelby Symptoms / novarname layout=rowlattice onepanel rows=3;
   hbar Group / response=Percent group=group;
   colaxis grid display=(nolabel);;
run;

View solution in original post

1 REPLY 1
Rick_SAS
SAS Super FREQ

Here are two options. The simplest way is to use PROC SGPLOT, but PROC SGPANEL has some options for paneling the data that might be useful:

data Have;
length Symptoms $16 Group $3;
input Symptoms Group Percent;
datalines;
viraux         A 58
viraux         B 20
viraux         C 12
viraux         D 10
vir_douloureux A 64
vir_douloureux B 25
vir_douloureux C 9
vir_douloureux D 2
respiratoire   A 57
respiratoire   B 23
respiratoire   C 14
respiratoire   D 6
;

title "An SGPLOT Example";
proc sgplot data=Have;
   hbar Symptoms / response=Percent group=Group groupdisplay=cluster 
        datalabel datalabelpos=data grouporder=descending;
   xaxis grid label="Percent";
   yaxis reverse;
run;

title "An SGPANEL Example";
proc sgpanel data=Have noautolegend;
   panelby Symptoms / novarname layout=rowlattice onepanel rows=3;
   hbar Group / response=Percent group=group;
   colaxis grid display=(nolabel);;
run;

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

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