Hello,
I have 2 very perplexing problems.
1 ) For the simple for loop below, I have 3 conditions that are met for a single output. I've verified by looking manually and graphing that all 8 combinations are indeed present in the data. However, this comes out lopsided, where only x1, x2 and x3 will populate in all cells in the X1 column. The entry x2, for example, will have double the number of entries assigned to it. Upon further inspection via subset, A1, B1 and C1 columns are indeed met for both x2 and x4, which would be in equal shares. All columns share the same data & modeling type.
I've also blocked out the entry that is gathering double the entries, just to see what will happen. Then the entries are bundled into x2, for example.
For( i = 1, i <= N Rows ( dt ), i++,
If( :A1[i] == "a1" & :B1[i] == "b1" & :C1[i] == "c1", :X1[i] = "x1";
:A1[i] == "a1" & :B1[i] == "b1" & :C1[i] == "c2", :X1[i] = "x2";
:A1[i] == "a1" & :B1[i] == "b2" & :C1[i] == "c1", :X1[i] = "x3";
:A1[i] == "a1" & :B1[i] == "b2" & :C1[i] == "c2", :X1[i] = "x4";
:A1[i] == "a2" & :B1[i] == "b1" & :C1[i] == "c1", :X1[i] = "x3";
:A1[i] == "a2" & :B1[i] == "b1" & :C1[i] == "c2", :X1[i] = "x4";
:A1[i] == "a2" & :B1[i] == "b2" & :C1[i] == "c1", :X1[i] = "x1";
:A1[i] == "a2" & :B1[i] == "b2" & :C1[i] == "c2", :X1[i] = "x2";
);
);
2) If I shorten the code by assigning values to cell with &, I get an error "attempting to assign to an object that is not an L-value". This is an attempt to shorten my code and not have multiple different loops. Below is an example of 3 criterion, and 3 outputs.
For( i = 1, i <= N Rows ( dt ), i++,
If( :A1[i] == "a1" & :B1[i] == "b1" & :C1[i] == "c1", :X1[i] = "x1" & :Y1[i] = "y1" & :Z1[i] = "z2";
:A1[i] == "a1" & :B1[i] == "b1" & :C1[i] == "c2", :X1[i] = "x2" & :Y1[i] = "y3" & :Z1[i] = "z3";
:A1[i] == "a1" & :B1[i] == "b2" & :C1[i] == "c1", :X1[i] = "x3" & :Y1[i] = "y2" & :Z1[i] = "z1";
:A1[i] == "a1" & :B1[i] == "b2" & :C1[i] == "c2", :X1[i] = "x4" & :Y1[i] = "y4" & :Z1[i] = "z4";
:A1[i] == "a2" & :B1[i] == "b1" & :C1[i] == "c1", :X1[i] = "x3" & :Y1[i] = "y1" & :Z1[i] = "z1";
:A1[i] == "a2" & :B1[i] == "b1" & :C1[i] == "c2", :X1[i] = "x4" & :Y1[i] = "y2" & :Z1[i] = "z4";
:A1[i] == "a2" & :B1[i] == "b2" & :C1[i] == "c1", :X1[i] = "x1" & :Y1[i] = "y4" & :Z1[i] = "z2";
:A1[i] == "a2" & :B1[i] == "b2" & :C1[i] == "c2", :X1[i] = "x2" & :Y1[i] = "y3" & :Z1[i] = "z3";
);
);
Any guidance would be appreciated. Thank you for your help in advanced!
Learning every day!