BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
SAS_Novice22
Quartz | Level 8

Hi SAS community,

 

I have a number of variables that include a variety of sub-groups nested within for each that I would like to separate out and evaluate. 

A concrete example, is a dataset I have for lab samples. Each variable includes a different set of  lab tests, or associated lab results, units and reference ranges etc. I would like to analyze the lab results and lab units for each set of lab tests. What is the best approach to analyze this data? 

Here is a snapshot of my data:

SAS_Novice22_1-1654693300220.png

As you can see I will also need to clean the data to make the units consistent as well... next item. 

I was considering generating a new variable for each lab test but it still would not solve my problem with also capturing the other data parameters such as lab result, unit of measure and low and high ref ranges.

My SAS code is as follows:

TITLE "Type of Lab Test "; 
PROC FREQ DATA=WORK.LB;
    TABLE LBTESTCD_DEC * OVERALL;
RUN;

TITLE "Lab Result "; 
PROC FREQ DATA=WORK.LB;
    TABLE LBORRES * OVERALL;
RUN;

TITLE "Lab Result Unit "; 
PROC FREQ DATA=WORK.LB;
    TABLE LBORRESU_DEC  * OVERALL;
RUN;

TITLE "Lab Low Reference Range"; 
PROC FREQ DATA=WORK.LB;
    TABLE LBORNRLO * OVERALL;
RUN;

TITLE "Lab High Reference Range"; 
PROC FREQ DATA=WORK.LB;
    TABLE LBORNRHI * OVERALL;
RUN;

I would like to evaluate basic descriptive data for each of the 4 lab tests (C4, C1-INH antigenic levels, C1-INH functional levels and C1q). I would like to look for items like out of range values for the corresponding results and units and compare to low and high reference ranges.

 

Any assistance would be greatly appreciated.

 

Thank you,

T.

 

1 ACCEPTED SOLUTION

Accepted Solutions
SAS_Novice22
Quartz | Level 8
Thank you @ballardw for your response. I have added in the details you have requested. I am looking to evaluate all of the variables of interest (LBORRES, LBORRESU_DEC, LBORNRLO, and LBORNRHI) by the 4 lab test subgroups (C4, C1-INH antigenic levels, C1-INH functional levels and C1q) found in LBTESTCD_DEC.

Thank you,
T.

View solution in original post

3 REPLIES 3
ballardw
Super User

It is pretty much impossible to write working code with pictures for data. You should provide some actual example data in the form of data step code.

 

Second, you did not provide any details of which variable(s) or how any of the "subgroups" that need to be analyzed are defined or what type of analysis is needed.

 

Many procedures are available that will provide results for each level of a variable but we do need to know the variable(s) to group the data on, the subgroups if any of the variable(s) and the type of analysis.

 

You can look at other posts to find examples of data step code creating data.

 

Note, do not provide spreadsheet as data. We would need to convert that to data for SAS and our choices in that process can very well create data that is significantly different from what you may have.

SAS_Novice22
Quartz | Level 8
Thank you @ballardw for your response. I have added in the details you have requested. I am looking to evaluate all of the variables of interest (LBORRES, LBORRESU_DEC, LBORNRLO, and LBORNRHI) by the 4 lab test subgroups (C4, C1-INH antigenic levels, C1-INH functional levels and C1q) found in LBTESTCD_DEC.

Thank you,
T.
SAS_Novice22
Quartz | Level 8
Resolved in a later thread.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 515 views
  • 0 likes
  • 2 in conversation