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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

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