SDTM codelist->XML mapper-> SAS formats

I was just experimenting with XML mapper. The CDISC website has codelists for CDASH, SDTM and ADAM in different formats including XML. Once I downloaded this file and loaded it into XML mapper I got .map file. This XML and .map files were read in SAS. It created SAS datasets with all the codelists provided be CDISC. Note: I tried it only for SDTM. The below macro creates SAS format based on the names of the codelist provided by user. For example if you want a SAS format for all values of LBTESTCD with its label then you can get it through this macro. Benefit: The codelist gets updated regularly. You can download a fresh copy with every update of the codelist in form of XML, run the mapper, read it in SAS and run the macro to get your needed formats. Mention name of any number of codelist separated by a space

libname xx xmlv2 ‘/folders/myfolders/tabulations/SDTM Terminology.xml’ automap=replace
xmlmap=’/folders/myfolders/tabulations/SDTM’;

proc copy in=xx out=work;
run;
%macro cod2form(clname=);
%do i=1 %to %sysfunc(countw(&clname));
data codelist2;
set codelist;
if strip(cdiscsubmissionvalue)=”%scan(&clname,&i)”;
drop preferredterm;
run;

data code(rename=(enumerateditem_codedvalue=start preferredterm=label));
merge codelist2(in=a) enumerateditem(in=b);
by codelist_ordinal;
if a;
fmtname=”$”||strip(cdiscsubmissionvalue);
keep fmtname enumerateditem_codedvalue preferredterm;
run;

proc format cntlin = code;
run;
%end;
%mend;
%cod2form(clname=LBTESTCD VSTESTCD EGTESTCD);

Leave a comment

Design a site like this with WordPress.com
Get started