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

In order to get uneven time space as following

yw2757_1-1587564196766.png

I manually type

Xaxis Label= "Analysis Visits"
Type= discrete
Values= (12 to 28 by 1) 
Valuesdisplay= ("Week 12" "Week 13" "" "" "Week 16" "" "" "" "Week 20" "" "" "" "Week 24" "" "" "" "Week 28 (Follow-up)");

However, I do find 

proc sgplot data=age;
  scatter x=age y=weight;
  xaxis grid values=(6 9 13 16 19 21 25 30 40 50) valueshint;
  yaxis grid;
  run;

can provide uneven space automatically. 

Any one can provide suggestions about how to get uneven space via PROC SGPLOT by using values= (  ) 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

I think a FORMAT statement is probably easiest, but you can also use SYMPUTX in a DATA _NULL_ step to create a macro variable that contains the tick values and the strings to display.

See the last paragraph "Automating the tick locations and labels" in the article "Create custom tick marks for axes on the log scale."

View solution in original post

3 REPLIES 3
ballardw
Super User

I think you need to rephrase your question or requirement.

Your question "how to get uneven space via PROC SGPLOT by using values= ( ) " is answered in your code with the values statement.

 

I think you may be having more a question about displaying specific text but it isn't clear if that is the case.

Likely a custom format for the values you want to display the desired text with an Other= ' ' to display blanks.

yw2757
Fluorite | Level 6

Sorry for the confusion. Before I used

values=(12 13 16 20 24 28)

valuesdisplay= ("Week 12", "Week 13", "Week 20", "Week 24", "Week 28")

and SGPLOT offers following result, all space are even. For example, space between week 13 and week 16. 

 

yw2757_0-1587566625675.png

 

Rick_SAS
SAS Super FREQ

I think a FORMAT statement is probably easiest, but you can also use SYMPUTX in a DATA _NULL_ step to create a macro variable that contains the tick values and the strings to display.

See the last paragraph "Automating the tick locations and labels" in the article "Create custom tick marks for axes on the log scale."

sas-innovate-white.png

🚨 Early Bird Rate Extended!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Lock in the best rate now before the price increases on April 1.

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1836 views
  • 0 likes
  • 3 in conversation