BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
karlbang
Fluorite | Level 6

I am trying to make a plot where the x-axis has values from 1 to 52 weeks, but I want to illustrate what the measurement times were:

 

xaxis label='Weeks'
values=("1" "3" "12" "52")
valuesdisplay=("1" "3" "12" "52")
LABELATTRS=(size=14) valueattrs=(size=14);

 

does not give me the expected axis, but rather:

'

axis.png

 

Any suggestion ?

1 ACCEPTED SOLUTION

Accepted Solutions
5 REPLIES 5
Ksharp
Super User

values=(1 3 12 52)

ChanceTGardener
SAS Employee

Try the refline option on the x axis at 1,3,12, and 52. Not sure if it's what you're looking for aesthetically, but it's one option to highlight where those points falls on the x axis. Eg below. 

 

data work.sampledata;
  do _n_=1 to 52;
    week+1;
    value=ranuni(1234);
    output;
  end;
keep week value;
run;

proc sgplot data=work.sampledata;
series x=week y=value;
xaxis values=(0 to 52);
refline 1 3 12 52 /axis=x transparency=0.85 lineattrs=(color=gray pattern=shortdash);
run;
karlbang
Fluorite | Level 6

Not what I am looking for. I want an x-avis with the numbers 1 3 12 52

DanH_sas
SAS Super FREQ

Ksharp had the correct answer, but you might also want to add VALUESHINT so that the min/max values of the list do not constrain the data shown:

 

xaxis values=(1 3 12 52) valueshint;

 

Hope this helps!
Dan

karlbang
Fluorite | Level 6
Thank you, I missed the solution from Ksharp when I frist looked

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 5 replies
  • 914 views
  • 0 likes
  • 4 in conversation