BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. 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.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 1689 views
  • 0 likes
  • 2 in conversation