DATA Step, Macro, Functions and more

Graphing frequencies of many variables

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 15
Accepted Solution

Graphing frequencies of many variables

I am trying to find a way to create a bar graph with mutiple disease types on it, while also grouping it by race. To do so (or at least how I know how to do it), I need a data set with the frequenceies of each disease type by race. I have variables Diseasetype1-Diseasetype10 and Race. I am hoping it will be something along the lines of creating a data set after a freq statement with all the disease types by all the race types?

 

I did this before just looking at the disease type as followed:

ods output onewayfreqs=diseasetables;

proc freq data=Disease;

tables diseasetype1 -- diseasetype10;

run;

 

Anyone have a solution that would be close to that but with disease crossed with race?


Accepted Solutions
Solution
‎10-03-2016 07:36 PM
Super User
Posts: 17,936

Re: Graphing frequencies of many variables

Transpose your data and then try and use a graphing procedure.

 

Your data should be in the structure, as follows:

 

Race DiseaseCount Disease

race1 1 DA

race1 2 DB

race1 3 DC

....

 

 

Once your data is in this structure you should be good to use a variety of methods.

 

View solution in original post


All Replies
Solution
‎10-03-2016 07:36 PM
Super User
Posts: 17,936

Re: Graphing frequencies of many variables

Transpose your data and then try and use a graphing procedure.

 

Your data should be in the structure, as follows:

 

Race DiseaseCount Disease

race1 1 DA

race1 2 DB

race1 3 DC

....

 

 

Once your data is in this structure you should be good to use a variety of methods.

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

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