In the
code editor, add the code to include the value-level metadata. The
following code provides an example of how to include the value-level
metadata on the SC domain. This example includes two values:
height without shoes
and
weight without
shoes
.
*Lookup OID for the SDTM 3.1.2 standard in MetaDataVersion;
proc sql noprint;
select OID into :mdv from _svWork.MetaDataVersion
where name="CDISC-SDTM 3.1.2";
quit;
*Lookup OID for the SCTEST column in ItemDefs;
proc sql noprint;
select OID into :srccol from _svWork.ItemDefs
where name='SCTEST';
quit;
*add record for a new valuelist SCTESTVALS;
proc sql ;
insert into _svWork.ValueLists
set OID= "SCTESTVALS",
FK_MetaDataVersion = "&mdv";
*add record associating the value list SCTESTVALS to the OID for SCTEST ItemDefs record;
insert into _svWork.ItemValueListRefs
set ValueListOID= "SCTESTVALS",
FK_ItemDefs = "&srccol";
*add records to the ItemDefs data set for each value in the SCTESTVAL value list;
insert into _svWork.ItemDefs
set OID= "VAL001",
Name = "SCTEST",
DataType = "text",
Length = 3,
SASFieldName = "SCTEST",
comment = "Height taken barefoot",
label="Height in inches",
FK_MetaDataVersion = "&mdv"
set OID= "VAL002",
Name = "SCTEST",
DataType = "text",
Length = 4,
SASFieldName = "SCTEST",
comment = "Weight without shoes",
label="Weight in pounds",
FK_MetaDataVersion = "&mdv";
*add records associating the value list SCTESTVALS to rows in the ItemDefs data set;
insert into _svWork.ValueListItemRefs
set ItemOID= "VAL001",
OrderNumber=1,
Mandatory="Yes",
KeySequence=1,
FK_ValueLists = "SCTESTVALS"
set ItemOID= "VAL002",
OrderNumber=2,
Mandatory="Yes",
KeySequence=2,
FK_ValueLists = "SCTESTVALS";
quit;
*reassign srcdata to location of _svWork data sets;
data _null_; path=pathname('_svwork'); rc=libname('srcdata');
rc=libname('srcdata',path);
run;
*create new define.xml file using updated SAS CRT-DDS data sets;
%crtdds_write(_cstCreateDisplayStyleSheet=1);