I am working with a data table that has variable number of rows. I want to assign a categorical description that I will define to a new column called 'Reason 1'. This 'Reason 1' column will be assigned when the 'Name' column matches any of the strings in any of the lists that I have defined.
The 'Name' row entry will match exactly with an entry in the ::slitter, ::label, or ::case lists.
I want to assign the different reason 1 codes to all rows and then analyze the data according to each Reason 1.
dt1 << New Column("Reason 1", Character, "Nominal");
Nrows = N Rows(dt1);
For( i =1, i<=Nrows, i++
For( j=1, j<= N items( ::slitter ), j++,
If(:Name(i) == Eval(slitter(j)), :Reason 1(i) = "Slitter");
);
);
// %Slitter% description codes
slitter = {"TM2300-370",
"TM2300-380",
"TM2300-385",
"TM2300-390",
"TM2300-395",
"TM2300-400"};<BR /><BR />// %Label% description codes (8)<BR />::label = {"TM2300-020",<BR />"TM2300-025",<BR />"TM2300-070",<BR />"TM2300-075",<BR />"TM2300-080",<BR />"TM2300-085",<BR />"TM2300-090",<BR />"TM2300-095"};<BR /><BR />//%Case% description codes (7)<BR />::case = {"TM2300-030",<BR />"TM2300-035",<BR />"TM2300-040",<BR />"TM2300-045",<BR />"TM2300-050",<BR />"TM2300-055",<BR />"TM2300-060"};