BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hello!

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 🙂
4 REPLIES 4
LinusH
Tourmaline | Level 20
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?

/Linus
Data never sleeps
deleted_user
Not applicable
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 🙂
ChrisNZ
Tourmaline | Level 20
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.
[pre]
TEST# CAT# RESULT
A x 3
B x 6
....
[/pre]
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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.

ON DATA TRANSFER - topic "HORIZONTAL TO VERTICAL DATA FORMAT":
Aileen L. Yam, Clinical Information Analysis, Inc., Plainsboro, NJ

http://www2.sas.com/proceedings/sugi23/Advtutor/p46.pdf

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

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
  • 4 replies
  • 614 views
  • 0 likes
  • 4 in conversation