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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 633 views
  • 2 likes
  • 2 in conversation