Hi,
I'm working on a complex data set which includes the % susceptibility, number of isolates tested for different bug drug combinations in different hospitals. So each hospital has the following:
I ran my SAS coding and got the total numbers of isolates tested and total number of susceptibles for each drug-bug combination in all the hospitals:
My report should have the % susceptible for all hospitals in each drug-organism (bug) combinations as below:
and:
So is there a way to aggregate the data in one % susceptible for all hospitals in each drug-bug combination instead of having them the way I did?
Thank you
The good news is that there are several ways to do it : data step, proc report, proc tabulate, proc iml, ...
The bad news is :
that it is not possible to program against data in a picture.
Is it possible to provide (a sample of) the input data in a data step with datalines;?
Kind regards,
Koen
Thank you Koen.
Here's a data step with datalines:
data Get;
run;
Hi, I've posted the datalines and the code I used for the analysis. Just checking if you had the time to look at it!
Thank you
Hello,
In your code below, you do all steps "by drug_bug;".
So then it is across hospitals, no?
How comes you think your aggregates are per hospital?
Thanks,
Koen
When I run the code, I get the ps_n, it_n and ns_n for each hospital in a drug_bug combination and a total for all the hospitals' ps_n, it_n and ns_n. What I need is the % of ps_n for all hospitals and not the totals.
If you show the code you used for "I ran my SAS coding and got the total numbers of isolates tested and total number of susceptibles for each drug-bug combination in all the hospitals:"
I might take a stab.
Hard to suggest code without variable names, characteristics or knowledge of the data set structure.
@mayasak wrote:
Hi,
I'm working on a complex data set which includes the % susceptibility, number of isolates tested for different bug drug combinations in different hospitals. So each hospital has the following:
I ran my SAS coding and got the total numbers of isolates tested and total number of susceptibles for each drug-bug combination in all the hospitals:
My report should have the % susceptible for all hospitals in each drug-organism (bug) combinations as below:
and:
So is there a way to aggregate the data in one % susceptible for all hospitals in each drug-bug combination instead of having them the way I did?
Thank you
OK.
What is still missing in the code you have specified above?
You already work with aggregates for each drug-organism across all hospitals which is what you were looking for.
So what is it you still miss?
Thanks,
Koen
The code gives me aggregates for each drug_bug combination and Ps (percent susceptible) for each hospital within the drug_bug combination. For example, for each combination I got the percent susceptibility for each hospital. What I'm looking for is an aggregate percent susceptibility for all hospitals combined, if possible.
Thank you
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.