BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
2 REPLIES 2
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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.
RichardH_sas
SAS Employee
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
etc.

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 645 views
  • 0 likes
  • 3 in conversation