Help using Base SAS procedures

Creating a table: which function to use?

Not applicable
Posts: 0

Creating a table: which function to use?


I have 45 variables called TEST (TEST1-TEST45) and 6 variables called RACE_CAT (RACE_CAT1-RACE_CAT6). There are approximately 900 observations in my dataset.
I need to create a table showing the counts of each and every test per race category; and I also need to calculate the rates of each test per 10,000 people/per race category.

Being a novice, I am having a hard time deciding between proc sql or using a multidimensional array. Do I need to calculate the totals for each variable beforehand to calculate the rates, or is there a way to do this in the process of creating the table??

I have tried to simplify my data as best as I can; all are coded as "1" if "yes" for each test or race category.

Can anyone help me??
Thanks Smiley Happy
Super User
Posts: 5,884

Re: Creating a table: which function to use?

Posted in reply to deleted_user
I would try to transpose the data, so that you'll have one test per row.
Don't exactly understand how you want to report on race, maybe you could attach some sample input and desired output to describe the problem?

Data never sleeps
Not applicable
Posts: 0

Re: Creating a table: which function to use?

Hi Linus, thanks for the response. The data is already transposed with one record per subject (every subject has 45 tests and 6 race category variables). I ended up just making 6 separate datasets per race category and importing it into Excel to do the calculations, it was just easier. But in the future, I would like to be able to create a table in SAS using some sort of Array or Proc Sql function....

Anyhow, thanks Smiley Happy
Posts: 2,370

Re: Creating a table: which function to use?

Posted in reply to deleted_user
Unsure I fully understand you goal, you might need to provide more details.

Linus' suggestion is good: in general, transposing the dataset (for example to have one record per figure), makes it easy to summarise it in funny ways.
A x 3
B x 6
Super Contributor
Super Contributor
Posts: 3,176

Re: Creating a table: which function to use?

It would be more like convert your horizontal SAS file to vertical, using a set of arrays to control an outer and inner loop, creating an output observation for each unique value combination based on some key variable list.

Scott Barry
SBBWorks, Inc.

Aileen L. Yam, Clinical Information Analysis, Inc., Plainsboro, NJ
Ask a Question
Discussion stats
  • 4 replies
  • 4 in conversation