I have three continuous variables, tot_doc_fp, tot_nurse_fp, and tot_mid_fp. For my analysis, I want to know if any combination of the values of the three variables is greater than or equal to 2 for any of the observations, and then for what percentage of observations the combined value is greater than or equal to 2. I'm on version 9.4.
set have end=the_end;
if sum(tot_doc_fp,tot_nurse_fp,tot_mid_fp) ge 2 then count_true+1;
if the_end then do;
the condition is that the sum of the variables is greater or equal 2, so any value can be on the input. In detail if one variable is ge 2 the condition is true, if you want something else, please specify your question.
The output fraction is stored in dataset want.
OK, th first part of my code creates a dummy dataset have with two observation. View this dataset.
In the next part i count the frequency and output the percentage. For one observation the condition holds true, for the other it does not. So the fraction is 0.5. I output this to the dataset want.
You need to provide more info or adapt the code for your case yourself.
It is best practice here to provide some example data that covers all of your data cases and the desired results for that example data. If you have missing values, negative values, etc. examples should be included. Best is to follow instructions from here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... to create data step code that allows us to recreate your example data to test code against.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.