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
- :
- Discussions
- :
- How to sort week number across year using JSL (JMP12)?

Topic Options

- Start Article
- 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

Jan 18, 2017 2:46 PM
(6110 views)

I have data by week number from Oct 2016 to the current week. I want to show the week numbers in correct order on the X-axis on bar chart going from week 48, 49, 50, 51, 1,2,3 etc. Or value ordering for WeekNumber column in the order of time stamp can help.

I created Year as another column and used Year axis along with WeekNum on Bar chart. But it didn't work as expected. please see the attached charts. Left one is the one I am getting right now, and the right one is the desired one. For a small dataset, we can reorder the WW values but it's tedious for a large data set.

I am using JMP12, it will be a big help if anyone can suggest a solution.

4 ACCEPTED SOLUTIONS

Accepted Solutions

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

Without seeing what you want your final product to look like, I will guess that what you may need to do is to change the Year and work week moding types to ordinal. Assuming the year and word week columns are numeric that should make the axis work out the way you want it to.

Jim

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

Thanks Jim. Yes, WW and Year are in numeric. but it didnt work out with ordinal modeling types for these columns.

Please see the attached chart. Desired chart is in the right and the one i am getting is in the left. Notice the week numbers. I had to reorder the week numbers to 49, 50, 51, 52, 1, 2.. which is quite tedious with large data set. Also i want to put it in script.

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

If you use Chart Builder, setting Year and Work Week to Ordinal and dragging both of them at the same time to the X axis and then drag the Y variable to the Y axis you will get the below chart

Jim

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

Thanks so much for the help Jim. It worked.

Now i have to add this capability into my script. Was looking on web but didnt find any solution. Please let me know if you can suggest something.

5 REPLIES 5

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

Without seeing what you want your final product to look like, I will guess that what you may need to do is to change the Year and work week moding types to ordinal. Assuming the year and word week columns are numeric that should make the axis work out the way you want it to.

Jim

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

Thanks Jim. Yes, WW and Year are in numeric. but it didnt work out with ordinal modeling types for these columns.

Please see the attached chart. Desired chart is in the right and the one i am getting is in the left. Notice the week numbers. I had to reorder the week numbers to 49, 50, 51, 52, 1, 2.. which is quite tedious with large data set. Also i want to put it in script.

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

If you use Chart Builder, setting Year and Work Week to Ordinal and dragging both of them at the same time to the X axis and then drag the Y variable to the Y axis you will get the below chart

Jim

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

Thanks so much for the help Jim. It worked.

Now i have to add this capability into my script. Was looking on web but didnt find any solution. Please let me know if you can suggest something.

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

Re: How to sort week number across year using JSL (JMP12)?

Are you asking, what is the JSL to do this chart? If this is your question, just go ahead and interactively create the chart, then go to the red triangle, click on it and got to Save the Script. You will get the code required to regenerate the chart.

Jim