BookmarkSubscribeRSS Feed
jayvisw11
Fluorite | Level 6

Hi,

I am trying to create a dual axis bar-line chart with a date column on the axis. I need the format of x-axis to be in weeks. I was able to achieve that but i do not have any insight into the date range of the week. Is there any way to show the x-axis in weeks with the timeframe? attached a screenshot for better understanding.

jayvisw11_0-1641757917682.png

Thank you!

1 REPLY 1
Stu_SAS
SAS Employee

Hey jayvisw11! There is not currently a format that shows the start of the week, but an easy way to do that is to create a date column that aligns all of your dates to the start of the week. For example:

 

data public.foo(promote=yes);
    set bar;
    week_date = intnx('week', date, 0, 'B');
    format week_date date9.;
run;

This will create dates that all start on the first day of a week. For example, in 2022:

 

Week Week Number
02JAN2022 1
09JAN2022 2
16JAN2022 3
23JAN2022 4
06FEB2022 5

 

If you'd like something truly custom, you can always go the custom format route and create something like a picture format that lists the week ranges for each date.  Check out this paper on using custom formats in CAS, and check out this paper on picture formats if you've never used them before.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 553 views
  • 0 likes
  • 2 in conversation