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
Meteorite | Level 14

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
Meteorite | Level 14

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
Meteorite | Level 14

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 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!

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

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