Desktop productivity for business analysts and programmers

Line Graph Help!

Not applicable
Posts: 0

Line Graph Help!

Hi Guys,

I am working on a line graph where my x-axis is day of the week . Is there a way where I can have X axis by the following order:

Mon Tue Wed Thu Wed Fri Sat Sun

Because the column is a string It give me the following order:
Friday Monday Sat Sun Tue Thu Wed
Super Contributor
Super Contributor
Posts: 3,176

Re: Line Graph Help!

Posted in reply to deleted_user
Suggest you may want to analyze your "internal" data variable values for the X axis. Also, consider posting your complete SAS code as it appears in the SAS log output with COPY/PASTE into a reply to your post.

Scott Barry
SBBWorks, Inc.
SAS Employee
Posts: 149

Re: Line Graph Help!

Posted in reply to deleted_user
Hmm, there are two solutions I can think of, one easy, one harder but a bit more professional.

The easy solution would be to recode the character values in your day of week column to the following.
1 - Mon
2 - Tue
3 - Wed

Because you literally have a number in front of the day, when the GRAPH code alphabetizes the X axis, you'll get the order you want. The only problem with this is you may not like the fact that you'll see the 1, 2, etc. in front of the weekdays.

The harder way is to recode the character column to have values like above, create a custom format, and then apply that custom format in the line plot task. There is a task for this (Create Format), and you'd want a value like "1 - Mon" to be displayed as "Monday". After creating the format, you'd need to apply it to the column in question. This typically can only be done within the task dialog interface, not in the wizard interface. So, if you are currently using the Line Plot Wizard, right-click, and open in advanced view to get the task dialog interface.

Let me know if you need more details.
Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation