How to convert original results to standard results using conversion factors


This post is part of 'SDTM | General' series

While working on the creation of SDTM datasets, we often find that the results of tests are collected in a different unit than the standard unit.

In such cases, to populate the standard results we need the conversion factors, and these are often provided in the form of an excel file or a sas dataset.

We make use of the conversion factors and programmatically convert collected results into standard results.


Below is an example of vital signs data in which some of the results are collected in non-standard units while some others are collected in standard units.

USUBJID

VSTESTCD

VSORRESU

VSORRES

VSSTRESU

1001

HEIGHT

m

1.68

cm

1001

WEIGHT

LB

138.9

kg

1002

HEIGHT

cm

170

cm

1002

WEIGHT

kg

60.5

kg

Description of the data

  • VSTESTCD variable has the test information - we have HEIGHT and WEIGHT collected in this example
  • VSORRESU variable has the original units in which the results are collected
  • VSORRES variable has the actual collected result associated with the test
  • VSSTRESU variable has the standard unit in which the results are to be presented as per the SDTM standard expectation

And, the conversion factors are provided in the form of a sas dataset with the structure as shown below.

TESTCD

ORRESU

Conversion_multiplier

HEIGHT

m

100

HEIGHT

cm

1

WEIGHT

LB

0.4536

WEIGHT

kg

1

Description of the data

  • TESTCD variable has the test information
  • ORRESU variable has the original result units
  • CONVERSION_MULTIPLIER variable has the conversion factor that must be multiplied to the original result to obtain the results in standard unit

To achieve this, we need to fetch the conversion factors associated with each test and unit to get a structure like this.

USUBJID

VSTESTCD

VSORRESU

VSORRES

VSSTRESU

Conversion_multiplier

1002

HEIGHT

cm

170

cm

1

1001

HEIGHT

m

1.68

cm

100

1002

WEIGHT

kg

60.5

kg

1

1001

WEIGHT

LB

138.9

kg

0.454

 


Below is an example SAS code that we can use to achieve the result.

data rvs;

   infile cards truncover;

   input USUBJID$ VSTESTCD$    VSORRESU$    VSORRES$ VSSTRESU$;

cards;

1001 HEIGHT   m   1.68 cm

1001 WEIGHT   LB  138.9    kg

1002 HEIGHT   cm  170 cm

1002 WEIGHT   kg  60.5 kg

;

run;


 

data cf;

   infile cards truncover;

   input TESTCD$ ORRESU$  Conversion_multiplier;

cards;

HEIGHT   m   100

HEIGHT   cm  1

WEIGHT   LB  0.4536

WEIGHT   kg  1

;

run;


 

proc sql;

   create table rvs01 as

      select a.*,b.conversion_multiplier

      from rvs as a

      left join

      cf as b

      on upcase(a.vstestcd)=upcase(b.testcd) and upcase(a.vsorresu)=upcase(b.orresu)

      order by usubjid,vstestcd

      ;

quit;

 


data rvs02;

   set rvs01;

   vsorresn=input(vsorres,??best.);

 

   if nmiss(vsorresn,conversion_multiplier)=0 then vsstresn=vsorresn*conversion_multiplier;

   drop conversion_multiplier vsorresn;

run;

 


And, the final output (VSSTRESN) looks like below. 

USUBJID

VSTESTCD

VSORRESU

VSORRES

VSSTRESU

vsstresn

1001

HEIGHT

m

1.68

cm

168

1001

WEIGHT

LB

138.9

kg

63.00504

1002

HEIGHT

cm

170

cm

170

1002

WEIGHT

kg

60.5

kg

60.5

Points to note:

  • We may want to round the result to appropriate number of decimals based on the precision required for each test




Filter a category
AllSASnRSDTMSASDomainADaMStatistics

List of other posts


Domain


General
What are CDISC standards?
What is a clinical development plan?
What is a clinical study report?
What is a clinical trial registry?
What is the importance of baseline characteristics in a clinical trial?
Drug discovery
Drug Development
Preclinical Research
The Investigational New Drug Process
What is ICH?
Efficacy data vs Safety data
What is a clinical trial?
Why are clinical trials conducted?
What is a clinical trial protocol?
Who conducts clinical trials?
Inclusion/Exclusion Criteria in a clinical trial
What are the phases of clinical trials?
What happens after a clinical trial is completed?
FDA Drug Review
Key steps in developing new drugs and biologicals

Trial design aspects
What is a crossover clinical trial?

Terminology
What is a cohort?

SAS


Definitions
What is a computer?
What happens when we execute a SAS program?
What is software?
What is SAS?
What is data?
What is data entry?
What is data retrieval?
What is data management?
What is "Report"?
What is statistics?
What is Statistical Analysis?
How do we use SAS?
What kind of questions can SAS help us answer?
How do we provide instructions to SAS?
What is a SAS program?
What does a SAS program contain?

General
Attributes of a SAS dataset
Rules for SAS dataset names
Rules for SAS variable names
Rules for SAS library names
Rules for character SAS format names
Reserved SAS dataset names
Rules for numeric SAS format names
What can SAS dataset options do?
Attributes of a SAS variable
Automatic conversion of data types in SAS
How does SAS expect our data to be organized?
Introduction to SAS interface
By groups in SAS

Informats
Rules for character SAS informat names

Proc freq
Count the number of times a particular value occurred in a variable of a dataset

Proc contents
Check the list of variables in a SAS dataset

Proc datasets
Delete all sas datasets from a library
Delete specific sas datasets from a library
Save specific sas datasets (and delete others) of a library
Rename SAS datasets using proc datasets change statement

Log issues
WARNING: No matching members in directory.

One-line definitions
What is a SAS library?
What is a libref?
What is an input statement?
What is infile statement?
What is set statement?
What is length statement?

SDTM


General
How to derive baseline flag in SDTM
How to create SEQ variable in SDTM
New domains in SDTM IG 3.3
What is a codelist?
How to derive study day variable in SDTM
What is SDTM?
Why do we need SDTM?
How to convert original results to standard results using conversion factors

Demographics
What information does SDTM.DM (Demographics) contain?

Adverse Events
What is causality assessment?
What information does SDTM.AE (Adverse Events) contain?

Disposition
What information does SDTM.DS (Disposition) contain?

Concomitant Medications
What information does SDTM.CM (Concomitant/Prior Medications) contain?

Procedures
What information does SDTM.PR (Procedures) contain?

ADaM


General
What is ADaM?

ADSL
What is ADSL as per ADaM standard?

BDS
What is BDS as per ADaM standard?

Statistics


General
Alpha and beta errors
What is correlation?

SASnR


Introduction
What is R?
What is an R package?
What is tidyverse?
What are the core packages of tidyverse?
What is haven package of tidyverse?
How to install tidyverse?
How to load core tidyverse packages into the R session?

Reading data
Import/Read SAS dataset into R

Creating sample data
How to create some sample data in SAS and R tidyverse

Subset variables (columns)
How to select only required variables/columns in SAS and R tidyverse?
How to drop unwanted variables/columns in SAS and R tidyverse?

Subset observations (rows)
How to select/subset required rows in SAS and R tidyverse

Appending data
Append two datasets in SAS and R tidyverse

Merging/joining data
Merge/full join two datasets in SAS and R tidyverse
Merge/inner join two datasets in SAS and R tidyverse
Merge/left join two datasets in SAS and R tidyverse

Sort (order) observations
Sort/order observations based on the values in a single variable in SAS and R tidyverse

Transpose/Restructure data
Restructure/transpose long data to wide data
Restructure/transpose wide data to long data

Obtain frequencies
Obtain frequencies/counts based on one variable - one-way frequencies in SAS and R tidyverse
Obtain frequencies/counts based on two variables - two-way frequencies in SAS and R tidyverse

Descriptive statistics
Descriptive statistics for a numeric variable using SAS and R tidyverse