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
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.
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.
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!
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.