A hypothetical study would like to determine what percentage of their participants are currently in-care and what percentage are currently virally suppressed. You have a hypothetical dataset that contains repeated laboratory results for each client (i.e. multiple rows of data per client). Variables include: client_id, test_date, test_type, test_result. Please describe how you would calculate the desired percentages. Please include specific functions (coding) that you would use in SAS to complete the analysis.
1. Use proc sort to put the data in the order of Patient and, within patient, descending date order.
2. Use either proc sort with nodupkey on Patient, of a datastep, outputting only the first (most recent) record for each patient
3. Run a proc freq to get the counts and percentages
Art, CEO, AnalystFinder.com
You have: client_id, test_date, test_type, test_result
What, in those variables, defines that someone is currently in-care andvirally suppressed?
Art, CEO, AnalystFinder.com
test_result determine that someone is currently in-care or virally suppressed.
test_result = positive = currently in-care
test_result = negative = virally suppressed
Can they only be one, the other or neither of the two?
Art, CEO, AnalystFinder.com
p.s. You'll get more informative info if you provide two data steps, one that shows example data, and the other that shows the file you'd like to create based on your example data.
Because there are repeated lab values the study participants can be either virally suppressed or currently in-care depending on the latest lab value i.e. test_date
A hypothetical study would like to determine what percentage of their participants are currently in-care and what percentage are currently virally suppressed. You have a hypothetical dataset that contains repeated laboratory results for each client (i.e. multiple rows of data per client). Variables include: client_id, test_date, test_type, test_result. Please describe how you would calculate the desired percentages. Please include specific functions (coding) that you would use in SAS to complete the analysis.
I think I already answered this in the thread at: https://communities.sas.com/t5/Base-SAS-Programming/Repeated-values/m-p/350399#M81439
Art, CEO, AnalystFinder.com
1. Use proc sort to put the data in the order of Patient and, within patient, descending date order.
2. Use either proc sort with nodupkey on Patient, of a datastep, outputting only the first (most recent) record for each patient
3. Run a proc freq to get the counts and percentages
Art, CEO, AnalystFinder.com
Thank you so much for your help!
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.