Subscribe Bookmark RSS Feed

How to split the data and plot the graphs based on date

nyeesg

Community Trekker

Joined:

Jan 27, 2014

I have the data for 2  years (2011 to 2013) with a date column in 'YYYY-MM-DD' format, I want to split the data into monthly  parts i.e 2011 Jan - Feb.... to 2013 Nov and also plot histogram calculate the total no case reported each month for period of 2 yeaer.

Please let me know  how can I split the data and the plot a line graph to compare the performance. I m very new to JMP. Kinldy assist

CASE ID                  DATE

BNZ123-2424      30/9/2011  1:34:00 PM

BNZ123-2425      31/9/2011  1:34:00 PM

4 REPLIES
imroze

Community Member

Joined:

Nov 14, 2012

HI nyeesg,

Regards to split the data monthly, the below article might be helpful.

Please check..

<http://www.sascommunity.org/mwiki/images/3/39/040-2012.pdf>

Thank You

pmroz

Super User

Joined:

Jun 23, 2011

Here's how to do it in JMP:

This code creates the table you listed:

dt = New Table( "My Cases", Add Rows( 2 ),

    New Column( "Case ID", Character, Nominal,

        Set Values( {"BNZ123-2424", "BNZ123-2425"} )

    ),

    New Column( "Date", Character, Nominal,

        Set Values( {"30/9/2011  1:34:00 PM", "31/9/2011  1:34:00 PM"} )

    )

);


The next block of code creates a new column called Monthly Date, which uses a formula based on the Date column.  You can use Monthly Date on the X axis in graph builder.

dt << New Column( "Monthly Date", Numeric, Nominal, Format( "m/y", 12 ),

        Input Format( "m/y" ),

        Formula(

            date_list = Words( :Date, "/ " );

            Informat( date_list[2] || "/" || date_list[3], "m/y" );

        ),

);


This block of code creates a new column called Monthly Date, which uses a formula based on the Date column.  You can use Monthly Date on the X axis in graph builder.

nyeesg

Community Trekker

Joined:

Jan 27, 2014

New Column( "Case ID", Character, Nominal,

        Set Values( {"BNZ123-2424", "BNZ123-2425"} )

My dataset contains abt 10000 caseids.. how to do set the caseid and date explicitly .


    New Column( "Date", Character, Nominal,

        Set Values( {"30/9/2011  1:34:00 PM", "31/9/2011  1:34:00 PM"} )

    )

)

    ),

pmroz

Super User

Joined:

Jun 23, 2011

Ignore that part of the code - that just creates a little table to play with.  The part you want to run is the second part:

dt = current data table();

// This adds the new formula column

dt << New Column("Monthly Date", Numeric, Nominal, Format("m/y",12 ),

        Input Format( "m/y" ),

        Formula(

            date_list = Words( :Date, "/ " );

            Informat( date_list[2] || "/" || date_list[3], "m/y" );

        ),

);