The cstutiladddscolumn
macro adds a new column and any corresponding column attributes used
by the SAS Clinical Standards Toolkit. An initial value can be specified
for the column if needed.
In this example, the
new column parameter (_cstColumn) is specified as comment2
.
The other parameters set the label, type, length, format, and initial
value for the column. The label is specified as Additional
comment
, the type is specified as C
(character),
the length is specified as 200
, the
format is specified as $200
, and the
initial value is specified as This is a test to add
a new variable
. The initial value is set for the comment2
column for all records.
**********************
* Add a new column *
**********************;
%cstutiladddscolumn(
_cstStd=CDISC-SDTM,
_cstStdVer=3.1.3,
_cstDS=newstudy.source_values,
_cstColumn=comment2,
_cstColumnLabel=Additional comment,
_cstColumnType=c,
_cstColumnLength=200,
_cstColumnFmt=$200.,
_cstColumnInitValue=This is a test to add a new variable);
Before running the macro,
the number of columns in the newstudy.source_values data set was 21.
After running the macro, the number of columns is 22 and the comment2
column was modified.
Here is the full set
of columns in the newstudy.source_values data set. The comment2 column
is at the bottom of the list with length, format, and label as specified
in the macro parameters:
Here is the modified
newstudy.source_values data set, which shows that the initial value
of
This is a test to add a new variable
was
set for the new column on all data set records:
Here is the modified
work.results data set:
Here is the updated
transaction log data set: