Creating a column with concatenated valuesHey all,
I'm trying to create new column which will include to rows/values. The first one is a variable and the second one is a concatenated expression of two variables.
No matter what I tried, I get an empty cell in the concatenated value. Can you please advise?
Example of what I tried:
stiop=10; stiPLL=20; stiPHL=30;
STIarg={char(stiop),char(stiPLL) ||"<"|| char(stiPHL)};
Operations<<
New Column( "STI", "nominal", Set Values( STIarg ) );
Automation and ScriptingBasic Data Analysis and ModelingRe: Creating a column with concatenated valuesI am confused. Can you please provide an example of what you expect your new column will look like?
Re: Creating a column with concatenated valuesSorry for the confusion.
The new column suppose to look like that:
Re: Creating a column with concatenated valuesThe action of JMP is to loop one row at a time through the data table when running a Formula() or Set Each Value().And by default, it will only be outputting to the current row. There are different ways to solve your issue, but this is the way I would do it

Names Default To Here( 1 );
Operations = Open( "$SAMPLE_DATA/Big Class.jmp" );
stiop = 10;
stiPLL = 20;
stiPHL = 30;
STIarg = {Char( stiop ), Char( stiPLL ) || "<PL><" || Char( stiPHL )};
Operations << New Column( "STI",
character,
Set each Value(
If( Mod( Row(), 2 ) != 0,
:STI = Eval( STIarg[1] ),
:STI = Eval( STIarg[2] )
)
)
);</PL>
or if you want it to only have the 2 rows

Names Default To Here( 1 );
Operations = Open( "$SAMPLE_DATA/Big Class.jmp" );
stiop = 10;
stiPLL = 20;
stiPHL = 30;
STIarg = {};
Insert into(STIarg, char(stiop));
Insert into(STIarg,Char( stiPLL ) || "<PL><" || Char( stiPHL ) );
Operations << New Column( "STI",
character, set values(STIarg));</PL>Re: Creating a column with concatenated valuesAs an alternative, you could use EvalList to evaluate the list entries before they get used via Set Values..
Please also note that you have to specify the data type: Character.
For numeric columns, even for ones with modeling type: Nominal the value will be casted -> Numeric:
"10" will survive as 10, but the second value will get lost.
stiop=10; stiPLL=20; stiPHL=30;
STIarg=EvalList({char(stiop),char(stiPLL) ||"<PL><"|| char(stiPHL)});
New Column( "STI",Character, Set Values( STIarg ) );</PL>