BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Juli13
Fluorite | Level 6

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 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

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

 

View solution in original post

8 REPLIES 8
art297
Opal | Level 21

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

Juli13
Fluorite | Level 6

test_result determine that someone is currently in-care or virally suppressed. 

test_result = positive = currently in-care

test_result = negative = virally suppressed

 

art297
Opal | Level 21

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.

 

Juli13
Fluorite | Level 6

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

Juli13
Fluorite | Level 6

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.

art297
Opal | Level 21

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

art297
Opal | Level 21

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

 

Juli13
Fluorite | Level 6

Thank you so much for your help!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 1158 views
  • 0 likes
  • 2 in conversation