BookmarkSubscribeRSS Feed
sascool
Calcite | Level 5

Hi everyone,

I came across this question in my working project. It does not seem to be a difficult task, but I just can not figure it out after spending the whole night, sigh....:smileyconfused:

There are two datasets, one contains patients ID and one continuous biomarker variable x, the other dataset provides the reference range of this biomarker x (lowref_x and highref_x) and corresponded disease severity score for each range of x. Since there is no common variable between the two datasets I have to come up with some coding to generate the disease severity score for each patient ID based on his marker value in dataset one and reference range in dataset two. Can anyone help me out on this? I really appreciate it!!

2 REPLIES 2
stat_sas
Ammonite | Level 13

Hi,

One way is to calculate range in both datasets and use this variable as a common variable to combine them. Provided that there is an exact relationship between ranges in both datasets.

Thanks

Naeem

proc sql;
create table a as
select id,range(x) as r from one
group by id;
quit;

data b;
set two;
r=highref_x-lowref_x;
run;

proc sql;
select a.id,a.r,b.severity from a
inner join b
on a.r=b.r;
quit;

ballardw
Super User

Another could be to use the reference data to create custom formats then use the appropriate format for any print or report procedures.

The specifics on using a data set to create a format are in reference for Proc Format and the CNTLIN option.

A manual example:

proc format;

value marker

1 - 10 = 'Low'

10<-20 = 'Medium'

20<-high= 'High';

run;

data test;

     input id x;

datalines;

1 4.5

2 11.7

3 205.6

;

run;

proc print data=test noobs;

     var id x;

     format x marker.;

run;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

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.

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
  • 2 replies
  • 1817 views
  • 0 likes
  • 3 in conversation