Creation of Metadata for the DM Table

This code is also available in: Deutsch Español Français
Difficulty Level
Beginner
Published on :
The program first defines a library path via a macro variable, then assigns a 'meta' libname to this location. The core of the script is a DATA step that reads embedded textual data (via 'datalines') to build the 'meta.dm_meta' table. This metadata table is designed to describe the structure of another table. An 'attr' column is dynamically generated to format the attributes of each variable, suggesting later use in a dynamic programming process.
Data Analysis

Type : CREATION_INTERNE


Data is created directly within the script using a 'datalines' statement. No external data source or SASHELP reading is performed.

1 Code Block
DATA STEP Data
Explanation :
This code block uses a DATA step to create the 'dm_meta' table in the 'meta' library. It reads the data provided between 'datalines' and ';', structuring it according to the 'name', 'type', 'length', and 'label' columns defined in the 'input' statement. An additional variable, 'attr', is calculated by concatenating the other fields to form a character string describing the attributes of each variable (label, length, and implicit type via '$').
Copied!
1%let path = H:\GraphicsGroup\dummy\sdtm-style\meta;
2 
3LIBNAME meta "&path";
4 
5*--------------------------------------------------------------------------------;
6*---------- metadata ----------;
7*--------------------------------------------------------------------------------;
8 
9DATA meta.dm_meta;
10 INPUT name $ 1-8 type $ 10-13 LENGTH $ 16-18 label $ 22-61;
11 LENGTH attr $100;
12 attr = trim(name) || " label='" || trim(label) || "' length=";
13 IF type = "char" THEN
14 attr = trim(attr) || "$";
15 attr = trim(attr) || trim(LENGTH);
16*--------1---------2---------3---------4---------5---------6-;
17DATALINES;
18STUDYID char 25 Study Identifier
19DOMAIN char 2 Domain Abbreviation
20USUBJID char 25 Unique Subject Identifier
21SUBJID char 25 Subject Identifier for the Study
22RFSTDTC char 19 Subject Reference Start Date/Time
23RFENDTC char 19 Subject Reference END Date/Time
24RFXSTDTC char 19 Date/Time of First Study Tretment
25RFXENDTC char 19 Date/Time of Last Study Tretment
26RFICDTC char 19 Date/Time of Informed Consent
27RFPENDTC char 19 Date/Time of END of Participation
28DTHDTC char 19 Date/Time of Death
29DTHFL char 1 Subject Death Flag
30SITEID char 25 Study Site Identifier
31INVID char 25 Investigator Identifier
32INVNAM char 200 Investigator Name
33BRTHDTC char 19 Date/Time of Birth
34AGE num 8 Age
35AGEU char 10 Age Units
36SEX char 1 Sex
37RACE char 50 Race
38ETHNIC char 50 Ethnicity
39ARMCD char 8 Planned Arm Code
40ARM char 50 Description of Planned Arm
41ACTARMCD char 8 Actual Arm Code
42ACTARM char 50 Description of Actual Arm
43COUNTRY char 3 Country
44DMDTC char 19 Date/Time of Collection
45DMDY num 8 Study Day of Collection
46;
47RUN;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.

Related Documentation

Aucune documentation spécifique pour cette catégorie.