BookmarkSubscribeRSS Feed
Unsaf
Calcite | Level 5

Hello, new to SAS here. 

 

Currently I have a dataset as follows:

 

               centre          Variable1        Variable2        Variable3 ... VariableN

Subject1   1-15             0 or 1             0 or 1             0 or 1          0 or 1

Subject2   1-15             0 or 1             0 or 1             0 or 1          0 or 1

.

.

.

Subjectn

 

My goal is to report the frequency of each variable by centre to generate a table where:

 

                  centre 1    centre 2 ... centre 15

Variable1    Freq 0       Freq 0        Freq 0

                   Freq 1       Freq 1        Freq 1

 

Variable 2   Freq 0       Freq 0        Freq 0

                   Freq 1       Freq 1        Freq 1

.

.

.

Variable n   Freq 0       Freq 0        Freq 0

                   Freq 1       Freq 1        Freq 1

 

 

Thanks for any help or support. Cheers. 

1 REPLY 1
Astounding
PROC Star

Here's an approach that should at least be in the ballpark:

 

proc tabulate data=have missing;
   class variable: centre;
   tables variable: , centre;
run;

There are lots of ways to customize the format of the output in PROC TABULATE.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 693 views
  • 2 likes
  • 2 in conversation