Hello,
I've been trying to recode many columns which contain a specific string in their column name using the recode function. I think I'm pretty close but the script is getting stuck with the column evaluations. So I'm missing something crucial somewhere. Any guidance would be greatly appreciated.
Best,
Sebastien
Names default to here(1);
Clear log();
New Table( "Subject_Demographics",
Add Rows( 48 ),
New Column( "Unique Subject Identifier",
Character,
"Nominal",
Set Selected,
Set Values(
{"8396882-P0101", "8396882-P0101", "8396882-P0102", "8396882-P0102",
"8396882-P0103", "8396882-P0103", "8396882-P0104", "8396882-P0104",
"8396882-P0201", "8396882-P0201", "8396882-P0202", "8396882-P0202",
"8396882-P0203", "8396882-P0203", "8396882-P0204", "8396882-P0204",
"8396882-P0301", "8396882-P0301", "8396882-P0302", "8396882-P0302",
"8396882-P0303", "8396882-P0303", "8396882-P0304", "8396882-P0304",
"8396882-P0401", "8396882-P0401", "8396882-P0402", "8396882-P0402",
"8396882-P0403", "8396882-P0403", "8396882-P0404", "8396882-P0404",
"8396882-P0501", "8396882-P0501", "8396882-P0502", "8396882-P0502",
"8396882-P0503", "8396882-P0503", "8396882-P0504", "8396882-P0504",
"8396882-P0601", "8396882-P0601", "8396882-P0602", "8396882-P0602",
"8396882-P0603", "8396882-P0603", "8396882-P0604", "8396882-P0604"}
)
),
New Column( "Alertness - Recoded",
Character,
"Nominal",
Set Selected,
Set Values(
{"", "", "", "", "", "", "", "", "", "", "Abnormal Finding",
"Abnormal Finding", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "Abnormal Finding", "Abnormal Finding", "Abnormal Finding",
"Abnormal Finding", "Abnormal Finding", "Abnormal Finding", "", "", "",
"", "Abnormal Finding", "Abnormal Finding", "", "", "", "", "", "", "",
"", "", ""}
)
),
New Column( "Xyx Reflex - Recoded",
Character,
"Nominal",
Set Selected,
Set Values(
{"Abnormal Finding", "Abnormal Finding", "Abnormal Finding",
"Abnormal Finding", "Normal", "Normal", "", "", "", "", "Normal",
"Normal", "Normal", "Normal", "Normal", "Normal", "Normal", "Normal",
"Normal", "Normal", "Normal", "Normal", "Normal", "Normal", "Normal",
"Normal", "Abnormal Finding", "Abnormal Finding", "Normal", "Normal",
"Normal", "Normal", "", "", "", "", "Abnormal Finding",
"Abnormal Finding", "Normal", "Normal", "Normal", "Normal", "Normal",
"Normal", "Normal", "Normal", "Normal", "Normal"}
)
),
New Column( "Ataxia - Recoded",
Character,
"Nominal",
Set Selected,
Set Values(
{"Abnormal Finding", "Abnormal Finding", "Abnormal Finding",
"Abnormal Finding", "Abnormal Finding", "Abnormal Finding",
"Abnormal Finding", "Abnormal Finding", "", "", "Abnormal Finding",
"Abnormal Finding", "", "", "", "", "", "", "", "", "", "", "", "",
"Abnormal Finding", "Abnormal Finding", "Abnormal Finding",
"Abnormal Finding", "", "", "Abnormal Finding", "Abnormal Finding", "",
"", "", "", "Abnormal Finding", "Abnormal Finding", "", "", "", "", "",
"", "", "", "Abnormal Finding", "Abnormal Finding"}
)
)
);
subject_incidence = Data Table( "Subject_Demographics" );
a = "Recoded";
col = subject_incidence << get column names( string );
show(col);
nc = N Items( col );
For( i = 1, i <= nc, i++,
If( Contains( col[i], a ),
subject_incidence << Begin Data Update;
subject_incidence << Recode Column(
column(subject_incidence, col[i]),
{Map Value( _rcOrig, {"", "Not Reported"}, Unmatched( _rcNow ) )},
Target Column( column(subject_incidence, col[i] ))
);
subject_incidence << End Data Update
)
);