BookmarkSubscribeRSS Feed
Ubai
Quartz | Level 8

Hi everyone,

I have a problem that probebly requires matrices. To simplify the problem I'll say I want to divide dataset A by dataset B. Dataset A contains demographic data of a population and has the following structre:

Dataset A
Country Year Age-group Sex    population.size
USA    1995    1    male    10,000
USA    1995    2    male    20,000
..    ..    ..    ..    ..


Dataset B contains the number of disease cases by each country, year, age group and sex.

Dataset B
Country Year Age-group Sex Nr.cases
USA    1995    1    male    500
USA    1995    2    male    400
..    ..    ..    ..    ..

and what I would like to calculate is the disease incidence, i.e. the number of case in that population in that year. For age group 1 it will be 500/10000=0.2.

Now this is all simple and can be done by merging the two datasets, but what I have is way bigger, which is what making everything complicated. I have many countries, 6 years, almost 25 age-groups, two sexes, number of cases, deaths and most importantly several diseases. This means I have different population sizes for each country by each year as well.

What I am thinking about is having each table saved a matrix, and then grouping similar matrices as an array. I can run the arthmetic operations then on a number of matrices.

However I have no experince in matrics. I do not know if they exist in SAS, and I'm not sure if this is the best way to do this analysis. What do you think? How would you do it?

thanks in forward

Ubai

3 REPLIES 3
error_prone
Barite | Level 11
Why is using merge-technique to complicated to solve this task? Can post the real structure of your datasets?
Patrick
Opal | Level 21

@Ubai

Sounds to me like something which could be solved with a rather simple SQL - but I probably misunderstand something.

What would really help: Provide sample data which illustrates the problem (working SAS data step code creating the sample data). Then show us how the desired result should look like.

Ubai
Quartz | Level 8

Hi @Patrick @error_prone,

 

I was able indeed to solve it with PROC SQL as well as merging files. Thanks a lot for the hint.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 3 replies
  • 596 views
  • 0 likes
  • 3 in conversation