Subscribe Bookmark RSS Feed

How to automate Survival tests in JMP?

neontiger

Community Trekker

Joined:

Mar 22, 2016

I have been doing survival tests almost 50 of those for different gene polymorphisms manually, which is comparatively more time consuming compared to the chi-square contingency tables that can be applied to multiple variables by one click under 'Fit X by Y'. I would like to know if there is a way to automate the process, similar to a macro command.

6 REPLIES
ian_jmp

Staff

Joined:

Jun 23, 2011

More or less any analysis in JMP can be automated using the JMP Scripting Language (JSL). This includes doing the 'same' analysis with different variables, and possibly consolidating the results. But the details will depend on the specific platform you want to use for your 'survival test'. Can you provide more details, please?

neontiger

Community Trekker

Joined:

Mar 22, 2016

I am using the older survival platform that provides log ranks and distribution of the time until an event. In 'Y Time to Event' goes the overall survival, censor becomes the corresponding overall survival status and finally grouping is modified according to the genes and generated variables (genotype, alternative allele prescends etc.). I have to browse through the menu, recall, search for my variable and then right click save image for over 50 different variables/columns representing genetic polymorphisms. I would appreciate precise instructions on how to execute JSL commands. Thanks for the fast response, Ian.

ian_jmp

Staff

Joined:

Jun 23, 2011

I'm happy to (try to) help, but need just a little more, unfortunately.

Could you make one of your reports 'by hand', then go to the red triangle at the top and select 'Script > Save Script to Script Window', please? Then cut and paste this code into a reply below. By all means change the column names if you are concerned about this.

Finally, which version of JMP are you using, please?

neontiger

Community Trekker

Joined:

Mar 22, 2016

I am using SAS's JMP eleventh (11th) version. This is the output of what you've asked for

Survival(

  Y( :Overall survival ),

  Censor( :Overall survival status ),

  Grouping( :Name( "gene1" ) ),

  Failure Plot( 0 ),

  Censor Code( 0 )

);

Other than automating survival tests, a function on saving images would be optimal.

ian_jmp

Staff

Joined:

Jun 23, 2011

Many thanks. The script below shows the idea. The Journal file currently contains all the output, but I think you only want some of it. Copy the code below, do 'File > New > New Script' and paste it in, then 'Edit Run' script. Obviously this code relies on the way you have named your columns, but it would be easy to add a user interface that allows you to select them.

NamesDefaultToHere(1);

// (1) Make some dummy data in table 'dt'

ng = 20; // Number of grouping (gene) columns to use

dt = New Table( "Gene Polymorphism Survival",

New Column( "Overall Survival",

Numeric,

"Continuous",

Format( "Best", 12 ),

Formula( Random Weibull( 1 ) )

),

New Column( ":Overall survival status",

Numeric,

"Nominal",

Format( "Best", 12 ),

Formula( Random Integer( 0, 1 ) )

),

Add Rows( 100 )

);

for (c = 1, c <= ng, c++, dt << New Column( "gene"||Char(c), Numeric, "Nominal", Format( "Best", 12 ), Formula( Random Integer( 3 ) )));

// (2) START HERE - Build a list of all the grouping (gene) columns in the table (gCol)

gCols = dt << getColumnNames("String");

for(c = Nitems(gCols), c >= 1, c--, If(!StartsWith(gCols, "gene"), RemoveFrom(gCols, c)));

// (3) Launch the survival platform (invisibly) for each gene column . . .

for(c = 1, c <= Nitems(gCols), c++,

sur = dt << Survival(

Y( :Overall survival ),

Censor( :Overall survival status ),

Grouping( gCols ), Failure Plot( 0 ),

Censor Code( 0 ),

Invisible

);

// (4) 'Harvest' and consolidate the results in some way:

//      Here we just build a JRN, but you can take whatever pieces of the report you like.

sur << Journal;

Report(sur) << closeWindow;

);

neontiger

Community Trekker

Joined:

Mar 22, 2016

Just note that my background on coding/programming is relatively weak, given that I only hold an MD degree. The script appears to have 2 problems

a) It doesn't provide the same results as the 'manual' way. For example:

11200_C34S2pu.png and 11210_6gmlezD.png

b) As you can see the original genotypes (categorical variables) are converted into 1,2,3.

Other than that the script runs smoothly and returns 20 tests.

I wouldn't also mind if I had to copy a string with all the column header names that I want to run (comma-separated) since I can do this easily from my file and generally I would aprreciate having a universal tool that can be applied in cases other than gene**.