Hello,
Is there a way to create a table displaying the frequencies of multiple variables compared to one variable using PROC FREQ? I'm using SAS 9.4.
Best,
Brittany Coote
The following code uses a data set you should have available. It does something similar to what you show but with out example input data it isn't obvious whether we need to sum something or are using counts. Run this and see if the results are at all like what you want.
proc tabulate data=sashelp.cars; class make ; class type; class origin; tables type origin, (all='All makes' make)*( colpctn n) ; run;
There are options and things that can change things like row or column headings, formats of values shown. ODS style choices or overrides in the code can remove cell boundaries, change background/foreground colors, fonts and lots of stuff.
Can you demostrate in a table what do you mean?
Please post a sample data and the frequency table you want to achive.
Do you mean?
proc freq data=have;
tables x*y;
run;
That is the format I am using, but I am trying to avoid having to do it for multiple variables. Is there a way to just compare multiple variables to one variable via frequencies?
Are you looking for something like?:
proc freq data=sashelp.class; tables sex*(age height weight); run;
Art, CEO, AnalystFinder.com
Is there a way to have an statement similar to this one come up with only one table rather than multiple tables? kind of like a demographics table comparing 2 different population (i.e. Smokers and Non Smokers).
Yes there is, but post your question in a new thread as this one is already closed. Plus, in the new thread you post, include some sample data (in the form of a datastep), as well as what you want the output to look like.
Art, CEO, AnalystFinder.com
Hello,
This table illustrates what I would like to display.
Thank you for your assistance.
The following code uses a data set you should have available. It does something similar to what you show but with out example input data it isn't obvious whether we need to sum something or are using counts. Run this and see if the results are at all like what you want.
proc tabulate data=sashelp.cars; class make ; class type; class origin; tables type origin, (all='All makes' make)*( colpctn n) ; run;
There are options and things that can change things like row or column headings, formats of values shown. ODS style choices or overrides in the code can remove cell boundaries, change background/foreground colors, fonts and lots of stuff.
How do I get 2 variables and 1 column of frequency (called number of subjects) into a table? Right now, I have the variables ID and site and I need number of patients without the frequency heading.
So the table would be
ID Site number of patients (given by freqency)?
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.