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:
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.
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.