turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Converting date categories to a continual date axi...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Sep 26, 2013 4:41 PM
(3188 views)

Hi all,

I measured the growth of a group of animals roughly once a month for three months, and then let two months go by before I measured them a final time. I would like to graph the average growth over time. To do this, I will need to include a gap along the x-axis to represent the two month period when I didn't record growth. In other words, my x coordinates are January 9, 10, 11; February 11, 12, 13; March 29, 30; April 11, 12; and July 9, 10. (It took me several days to measure all the individuals in the population each time, so each "monthly" measurement actually consists of two or three days.) How do I get the program to recognize these as dates and space them accordingly along the x-axis when I construct a graph? Alternatively, how do I change the dates to Julian day? I'd rather display the actual dates with tick marks representing every day, or every 10 days or whatever, that provide the correct spacing in between the dates.

Thanks very much for your help.

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Sep 27, 2013 12:13 PM
(4192 views)

Solution

Hi rrimler,

Suppose your data looks like this. Notice that the Measurement Date column is of text type, and the dates are in the form ddMonYYYY.

Right click on the empty column header next to the word "Growth" and select "**New Column**". Call this column **Measurement Dt**.

Set the format of the data to **Date > ddMonYYYY**

Click on **Column Properties > Formula**.

Click on the **Edit Formula button**

Double click inside the red box that says **no formula** and enter the following text: **informat(:Measurement Date, "ddMonYYYY")**

Click **OK** and the **OK** again.

Now your dataset has a numeric column that shows the date you entered in the first column.

Click on **Graph > Graph Builder**. Drag **Measurement Dt** to the X axis, and **Growth** to the Y axis.

9 REPLIES

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Sep 27, 2013 5:37 AM
(2512 views)

hi

Proc SGPLOT supports time axis, see sample code below.

infile cards dlm=",";

input

date : date9.

;

format date date9.;

population = ceil( rand("uniform") *

cards;

09jan2013

10jan2013

11jan2013

11feb2013

12feb2013

13feb2013

29mar2013

30mar2013

11apr2013

12apr2013

09jul2013

10jul2013

;

series x=date y=population / markers;

yaxis min=

xaxis type=time interval=week grid;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Sep 27, 2013 6:05 AM
(2512 views)

Assuming you use JMP, you need to use a continuous, date-formatted column as x-variable.

One way to convert your date strings into date-values is to use a column formula. In the jsl example below the strings are found in column "x" and the formula in column "Date" turn "x" into the corresponding date (here based on the first day of the measurement interval).

dt = New Table**(** "example",

Add Rows**(** **4** **)**,

New Column**(** "x",

Character,

Nominal,

Set Values**(** **{**"January 9, 10, 11", "February 11, 12, 13", "April 11, 12", "July 9, 10"**}** **)**

**)**

**)**;

dt << New Column**(** "Date",

Numeric,

Continuous,

Format**(** "ddMonyyyy", **12** **)**,

Input Format**(** "ddMonyyyy" **)**,

formula**(** Parse Date**(** Words**(** :x, ", " **)[****2****]** || Left**(** :x, **3** **)** || "2013", "ddMonyyyy" **)** **)**

**)**;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Sep 27, 2013 10:56 AM
(2512 views)

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Sep 27, 2013 12:13 PM
(4193 views)

Hi rrimler,

Suppose your data looks like this. Notice that the Measurement Date column is of text type, and the dates are in the form ddMonYYYY.

Right click on the empty column header next to the word "Growth" and select "**New Column**". Call this column **Measurement Dt**.

Set the format of the data to **Date > ddMonYYYY**

Click on **Column Properties > Formula**.

Click on the **Edit Formula button**

Double click inside the red box that says **no formula** and enter the following text: **informat(:Measurement Date, "ddMonYYYY")**

Click **OK** and the **OK** again.

Now your dataset has a numeric column that shows the date you entered in the first column.

Click on **Graph > Graph Builder**. Drag **Measurement Dt** to the X axis, and **Growth** to the Y axis.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Oct 15, 2013 1:29 PM
(2512 views)

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Oct 16, 2013 5:47 AM
(2512 views)

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Oct 16, 2013 8:44 PM
(2512 views)

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Sep 27, 2013 12:38 PM
(2512 views)

Yes, a column formula is added by adding the property Formula to a column, as PMroz shows nicely. In my example, the formula is just the expression within Formula(). You do not need to understand the rest of the code. The entire code was for demonstration only, and was supposed to make an example table and add a column with that particular formula. Try it! Copy the code to a JMP script window and hit run. You can copy the formula from the example table to your own data table if it seems to work the way you want.

Regarding *dt, *it is just a variable for for the data table.

Bruno's code is for SAS and will not work in JMP.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Oct 15, 2013 1:30 PM
(2512 views)