Subscribe Bookmark RSS Feed

script to export a plot and summary of survival analysis to a MS word

chang

Community Trekker

Joined:

Jul 11, 2012

Hi,

I've had script for a survival analysis that could produce (1) a failure plot, (2) summary and test between groups for two comparison group. I've tried to export these to a journal and save as a MSword, nothing happened. Even the file "JournalTest.doc" did not appear in the folder. Could you please help me revise my codes? I've attached my data table and a test journal that shows what I want. Shorten my codes wherever possible.

// get all the rows from database

dbq_string = "DBQ=E:\Now\(Project) RFID_r3_Homing_r1\Ben analysis\Chang_bee_db.mdb;" ||

             "DefaultDir=E:\Now\(Project) RFID_r3_Homing_r1\Ben analysis;" ||

             "Driver={Microsoft Access Driver (*.mdb)};DriverId=25;FIL=MS Access;" ||

             "FILEDSN=C:\Program Files\Common Files\ODBC\Data Sources\chang_bee_db.dsn;" ||

             "MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;SafeTransactions=0;Threads=3;UID=admin;UserCommitSync=Yes;";

dt1=Open Database(dbq_string, "SELECT * FROM qryAFF14", "qryAFF14", invisible);

// get curves of 3 groups in one failure plots

dt=data table ("qryAFF14", invisible); /*invisible: to closes the data table window*/

dt<< Survival(

    Y( :AFF14 ),

    Grouping( :treatment ),

    Failure Plot( 1 ),

    Survival Plot( 0 ),

    Where( :treatment == "acetone 5µl" | : treatment== "nil" | :treatment == "methoprene 5µll (40 µg/µl)" ),

    SendToReport(

        Dispatch(

            {"Failure Plot"},

            "Failing",

            TextEditBox,

            {Set Text( "Rates of initiating the first flight" )}

        ),

        Dispatch(

            {"Failure Plot"},

            "AFF14",

            TextEditBox,

            {Set Text( "Age (day)" )}

        )

    )

);

// output the failure plot to a journal. how to modify underlined part for export the plot?

dt<<journal (freeze all);

dt<<close window;

current journal()<<minimize window;

Page Break Box() << Journal;

dts = dt << Summary( Group( :treatment ), N, Mean (:AFF14), Std Error, output table name( "qryAFF14_out" ) );

dts << Journal( Freeze All );

dts << close window;

Current Journal() << save HTML("E:\Now\(Project) RFID_r3_Homing_r1\Ben analysis\JMP\JournalTest.htm");

Current Journal() << save MSWord("E:\Now\(Project) RFID_r3_Homing_r1\Ben analysis\JMP\JournalTest.doc");

Current Journal() << save RTF("E:\Now\(Project) RFID_r3_Homing_r1\Ben analysis\JMP\JournalTest.rtf");

// get summary and tests between group, this part works

dt<< Survival(

    Y( :AFF14 ),

    Grouping( :treatment ),

    Failure Plot( 0 ),

    survival plot(0),

    ,Where( :treatment == "acetone 5µl" | :treatment == "nil" ),

)

<<Survival(

    Y( :AFF14 ),

    Grouping( :treatment ),

    Failure Plot( 0 ),

    survival plot(0),

    ,Where( :treatment == "acetone 5µl" | :treatment == "methoprene 5µll (40 µg/µl)" ),

);

// export summary and tests between group, not working. how to modify script for these two

dt<<journal(freeze all);

dt<<close window;

current journal()<<minimize window;

Page Break Box() << Journal;

dts = dt << Summary( Group( :treatment ), N, Mean (:AFF14), Std Error, output table name( "qryAFF14_out" ) );

dts << Journal( Freeze All );

dts << close window;

Current Journal() << save HTML("E:\Now\(Project) RFID_r3_Homing_r1\Ben analysis\JMP\JournalTest.htm");

Current Journal() << save MSWord("E:\Now\(Project) RFID_r3_Homing_r1\Ben analysis\JMP\JournalTest.doc");

Current Journal() << save RTF("E:\Now\(Project) RFID_r3_Homing_r1\Ben analysis\JMP\JournalTest.rtf");