cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-38205%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ETabella%20dati%20del%20sottoinsieme%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-38205%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3ECiao%20a%20tutti%2C%3C%2FP%3E%0A%3CP%3EDal%20mio%20post%20precedente%2C%20affronto%20il%20problema%20dei%20dati%20del%20sottoinsieme.%20Utilizzo%20l'hard%20coding%20per%20elencare%20la%20tabella%20dei%20dati%20dei%20sottoinsiemi%20una%20per%20una.%3C%2FP%3E%0A%3CP%3EMa%20ora%20voglio%20dinamicare%20il%20codice%2C%20uno%20dei%20motivi%20per%20cui%20non%20voglio%20elencarli%20uno%20per%20uno%20(hard%20coding)%20%C3%A8%20se%20in%20futuro%20avr%C3%B2%2050%20FD%20in%20un%20set%20di%20dati%2C%20quindi%20%C3%A8%20impossibile%20per%20me%20elencare%20quello%20FD%20per%20uno%2C%20giusto%3F%3C%2FP%3E%0A%3CP%3EProvo%20a%20utilizzare%20lo%20script%20seguente%2C%20ma%20riscontro%20ancora%20degli%20errori%20e%20stampa%20solo%20la%20tabella%20dei%20dati%20del%20sottoinsieme%20del%20primo%20f_d%20solo%20per%20me.%3C%2FP%3E%0A%3CP%3EQuindi%2C%20come%20posso%20iterare%20fino%20al%205%20f_d%3F%20(perch%C3%A9%20ora%20ho%205%20f_d)%3C%2FP%3E%0A%3CP%3EGrazie.%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Edt%20%3D%20Open(%20%3CPATH%20to%3D%22%22%20open%3D%22%22%20data%3D%22https%3A%2F%2Fcommunity.jmp.com%2F%22%20table%3D%22%22%3E)%3B%20%2F%2F%20Cambia%20il%20nome%20della%20colonna%20%22FD%22%20in%20%22f_d%22%22%20per%20corrispondere%20all'esempio%20dt%3AFD%20%26lt%3B%26lt%3B%20set%20name(%20%22f_d%22%20)%3B%20a%20%3D%20%7B%22S_GX_F40%22%2C%20%22S_GX_Z40%22%2C%22S_III_E110%22%2C%22S_III_E80%22%2C%20%22S_III_SL150%22%7D%3B%20dt%20%26lt%3B%26lt%3B%20Seleziona%20dove%20(inizia%20con%20(%20%3Af_d%2C%20a%5B1%5D%20)%20)%3B%3CBR%20%2F%3E%20baseDT%20%3D%20dt%20%26lt%3B%26lt%3B%20Sottoinsieme(nome%20tabella%20di%20output(%20%22Sottoinsieme%22)%2C%20righe%20selezionate(%201%20)%2C%20colonne%20selezionate(%200%20)%20)%3B%3CBR%20%2F%3E%20For(%20i%20%3D%201%2C%20i%20%26lt%3B%3D%20N%20elementi(%20a%20)%2C%20i%2B%2B%2C%3CBR%20%2F%3E%20dt%20%26lt%3B%26lt%3B%20Seleziona%20dove%20(inizia%20con%20(%20%3Af_d%2C%20a%20)%20)%3B%3CBR%20%2F%3E%20TempDT%20%3D%20dt%20%26lt%3B%26lt%3B%20Sottoinsieme%20(nome%20tabella%20di%20output%20(%22Sottoinsieme%22)%2C%20righe%20selezionate%20(1)%2C%20colonne%20selezionate%20(0))%3B%3CBR%20%2F%3E%20baseDT%20%3D%20baseDT%20%26lt%3B%26lt%3B%20concatena(%20TempDT%2C%20aggiungi%20alla%20prima%20tabella(%201%20)%20)%3B%3CBR%20%2F%3E%20Chiudi%20(TempDT%2C%20nosave)%3B%3CBR%20%2F%3E%20)%3B%3CBR%20%2F%3E%3C%2FPATH%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%20%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-38211%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERi%3A%20Tabella%20dati%20sottoinsieme%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-38211%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHo%20gi%C3%A0%20risolto%20il%20problema%20della%20tabella%20dei%20dati%20del%20sottoinsieme%3CBR%20%2F%3E%20Grazie.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-38210%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERi%3A%20Tabella%20dati%20sottoinsieme%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-38210%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EGrazie%20Craige_Hales%20per%20la%20risposta.%3C%2FP%3E%0A%3CP%3EMa%20ora%20posso%20generare%20solo%20la%20tabella%20dei%20dati%20del%20sottoinsieme%20individuale.%3CBR%20%2F%3E%20Come%20posso%20generare%20tutta%20la%20tabella%20dei%20dati%20del%20sottoinsieme%3F%20ho%205%20f_d%20l%C3%AC%2C%20quindi%20devo%20generare%205%20tabelle%20di%20dati%20di%20sottoinsiemi.%3C%2FP%3E%0A%3CP%3ENella%20mia%20codifica%2C%20utilizzo%20il%20loop%2C%20ma%20sembra%20che%20non%20funzioni.%3C%2FP%3E%0A%3CP%3EGrazie%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-38209%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERi%3A%20Tabella%20dati%20sottoinsieme%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-38209%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3ELa%20colonna%20%C3%A8%20una%20colonna%20di%20caratteri%3F%20Nel%20messaggio%20non%20c'%C3%A8%20alcun%20pedice%20su%20%22a%22%2C%20il%20che%20potrebbe%20significare%20che%20si%20tratta%20di%20una%20lista%20piuttosto%20che%20di%20un%20elemento%20della%20lista.%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Edt%20%3D%20Open(%20%22%24sample_data%2Fbig%20class.jmp%22%20)%3B%0Aletters%20%3D%20%7B%22B%22%2C%20%22C%22%7D%3B%0Adt%20%26lt%3B%26lt%3B%20selectWhere(%20Starts%20With(%20dt%3Aname%2C%20letters%5B2%5D%20)%20)%3B%0Adt%20%26lt%3B%26lt%3B%20subset(%20selected%20rows(%201%20)%20)%3B%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Names%20starting%20with%20C%22%20style%3D%22width%3A%20496px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Names%20starting%20with%20C%22%20style%3D%22width%3A%20496px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F5895i6DE9D7A5E9979CFB%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22datatable.PNG%22%20alt%3D%22Names%20starting%20with%20C%22%20%2F%3E%3Cspan%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3ENames%20starting%20with%20C%3C%2Fspan%3E%3C%2Fspan%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3ENomi%20che%20iniziano%20con%20C%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%20%3C%2FP%3E%0A%3CP%3E%20%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-38206%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERi%3A%20Tabella%20dati%20sottoinsieme%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-38206%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EContinua%20a%20comparire%20questo%20errore%20quando%20eseguo%20lo%20script%3A%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3El'argomento%20dovrebbe%20essere%20il%20carattere%7B1%7D%20nell'accesso%20o%20nella%20valutazione%20di%20'Inizia%20con'%20%2C%20Argomento%20errato(%20S%20)%2C%20Inizia%20con%2F*%23%23%23*%2F(%3Af_d%2C%20a)%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EQuindi%2C%20come%20risolverlo%3F%3C%2FP%3E%0A%3CP%3EGrazie.%3C%2FP%3E%0A%3CP%3E%20%3C%2FP%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
blue1994
Level III

Subset data table

Hi all,

From my previous post, i face the subset data problem. I using the hard coding to list down the subset data table one by one.

But now i want dynamic the code, one of the reason that i don't want list down one by one(hard coding ) is if in future I have 50 F D in one dataset, so is impossible to me to list down the F D one by one right?

I try using the script below, but still have errors, and it only print the first f_d's subset data table for me only.

So, how can i do it to iterate until the 5 f_d?(because now i have 5 f_d)

Thanks.

dt = Open( <path to open data table>);


// Change the column name "F D" to "f_d"" to match the example
dt:F D << set name( "f_d" );
a = {"S_GX_F40", "S_GX_Z40","S_III_E110","S_III_E80","S_III_SL150"};
dt << Select Where( Starts With( :f_d, a[1] ) );
baseDT = dt << Subset( output table name( "Subset" ), selected rows( 1 ), selected columns( 0 ) );
For( i = 1, i <= N Items( a ), i++,
dt << Select Where( Starts With( :f_d, a ) );
TempDT = dt << Subset( output table name( "Subset" ), selected rows( 1 ), selected columns( 0 ) );
baseDT = baseDT << concatenate( TempDT, append to first table( 1 ) );
Close( TempDT, nosave );
);

 

1 ACCEPTED SOLUTION

Accepted Solutions
Craige_Hales
Super User

Re: Subset data table

Is the column a character column? In the message there is no subscript on "a" which might mean it is a list rather than an element of the list.

dt = Open( "$sample_data/big class.jmp" );
letters = {"B", "C"};
dt << selectWhere( Starts With( dt:name, letters[2] ) );
dt << subset( selected rows( 1 ) );

Names starting with CNames starting with C

 

 

Craige

View solution in original post

4 REPLIES 4
blue1994
Level III

Re: Subset data table

It keep comes out with this error when i run the script:

argument should be character{1} in access or evaluation of 'Starts With' , Bad Argument( S ), Starts With/*###*/(:f_d, a)

So, how to I solve it?

Thanks.

 

Craige_Hales
Super User

Re: Subset data table

Is the column a character column? In the message there is no subscript on "a" which might mean it is a list rather than an element of the list.

dt = Open( "$sample_data/big class.jmp" );
letters = {"B", "C"};
dt << selectWhere( Starts With( dt:name, letters[2] ) );
dt << subset( selected rows( 1 ) );

Names starting with CNames starting with C

 

 

Craige
blue1994
Level III

Re: Subset data table

Thanks Craige_Hales for reply.

But i now only can generate the individual subset data table.
How can i generate out all the subset data table? i have 5 f_d there, so i need generate out 5 subset data table.

In my coding, i have using loop, but it seems cannot functions.

Thanks 

blue1994
Level III

Re: Subset data table

I have solve my subset data table problem already
Thanks.

Recommended Articles