How can i Specific value copy?Names Default To Here( 1 );
db_test = Open( "$SAMPLE_DATA/big class.jmp" );
mycol = Column("age");
xf = db_test << get rows where(contains(column(1)[],"O"));
xm = db_test << get rows where(contains(column("sex")[],"M"));
xa = db_test << get rows where( mycol[]== 13);
show (xf, xm, xa);
New Column( "Select", "Character", <<SET each="" value=""></SET>
I'd like to select specific cells and add new column only specific value.
Above the script doesn't work.
How can i make it work?
Re: How can i Specific value copy?I would separate the creation of the new column and populating the new column into two steps in this case. Here is a simplified version of your example to illustrate my approach.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
xf = dt << Get Rows Where( Contains( Column( 1 )[], "O" ) );
New Column( "Select", "Character" );
dt:Select[xf] = "M";
Re: How can i Specific value copy?@markbailey
Thanks a lot for your help!
I have one more question. How can i write the name? not M
Below script didn't work.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );
xf = dt << Get Rows Where( Contains( Column( 1 )[], "O" ) );
New Column( "Select", "Character" );
dt:Select[xf] = dt:name[xf];
xy = dt << Get Rows Where(
Is missing( :Select)
);
dt:Select[xy] = "Pass"
Re: How can i Specific value copy?I believe this is a simpler way to do what you want
Names Default To Here( 1 );
dt = Current Data Table();
dt << New Column( "Select",
character,
formula(
If( Contains( As Column( 1 ), "O" ),
:name,
"Pass"
)
)
);