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

Hello everyone, 

 

I am trying to analyze the BRFSS 2013 data and want to create a plot like 

a_matharu_0-1682663656134.png

Can someone guide me on how to create a graph like this in SAS.? I tried using the code mentioned below -   

 

ods graphics / reset width=6.4in height=4.8in imagemap;

proc sgplot data=WORK.BRFSS_13N;
vbar SEX_N / group=educatg group= _RFSMOKN groupdisplay=cluster datalabel;
yaxis grid;
run;

ods graphics / reset;

 

 

It created a graph with Education level at X-axis and grouped the data by SEX but I need to add another variable Smoking into the picture.

Kindly guide me. Thank you for your time and help

 

1 ACCEPTED SOLUTION

Accepted Solutions
yabwon
Onyx | Level 15

SGPANEL example:

proc sgpanel data=sashelp.prdsale;
  panelby year / columns=2;

  vbar product / response=actual 
  GROUP=region GROUPDISPLAY=CLUSTER 
  ;
run;
title;

Gives:

yabwon_0-1682665983517.png

 

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



View solution in original post

4 REPLIES 4
yabwon
Onyx | Level 15

did you try with SGPANEL? (https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatproc/p17wwoehcyc6mxn1hpcgxy8ixw6w.htm)

 

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



yabwon
Onyx | Level 15

SGPANEL example:

proc sgpanel data=sashelp.prdsale;
  panelby year / columns=2;

  vbar product / response=actual 
  GROUP=region GROUPDISPLAY=CLUSTER 
  ;
run;
title;

Gives:

yabwon_0-1682665983517.png

 

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



a_matharu
Calcite | Level 5
Thank you for your kind reply. That worked.!
ballardw
Super User

Just to be persnickety, did you use one of the survey procs to use the sample design and weighting data in the BRSS data to get the weighted population counts, or possibly another tool like SUDAAN to deal with the complex sample design?

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 655 views
  • 0 likes
  • 3 in conversation