multiplying two datasets by one anther

Posts: 25

multiplying two datasets by one anther

[ Edited ]

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


Regular Contributor
Posts: 204

Re: multiplying two datasets by one anther

Why is using merge-technique to complicated to solve this task? Can post the real structure of your datasets?
Respected Advisor
Posts: 4,696

Re: multiplying two datasets by one anther


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.

Posts: 25

Re: multiplying two datasets by one anther

[ Edited ]

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.

Ask a Question
Discussion stats
  • 3 replies
  • 3 in conversation