Data visualization with SAS programming

SGPLOT - Multiple reference lines with blank label

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 6
Accepted Solution

SGPLOT - Multiple reference lines with blank label

[ Edited ]

I am trying to make a plot essentially showing means and confidence intervals for several different variables, and I want to have multiple dashed lines separating them at certain points. See screenshot below:

 

SGPlot35.png

 

The only thing I want to change is that I want "blank1" and "blank2" to actually show up as blank, i.e. no text/label in those spots. Currently I have my dataset set up so that there are two rows corresponding to the two blank spots, with missing means and bounds. The problem is that, if I try naming or formatting the variable name as " ", then they have the same name and so only one of the dashed lines shows up. Any suggestions as to how to accomplish what I'm aiming for?


Accepted Solutions
Solution
‎10-15-2017 02:37 PM
SAS Super FREQ
Posts: 1,184

Re: SGPLOT - Multiple reference lines with blank label

[ Edited ]
Posted in reply to Sanjay_SAS

With 9.40M3 (I did not check if this works with earlier releases) you can use a character format to do the same.  Keep the unique values in the category variable (like "a" and "b"), and then use a character format to format these to blank.  It is important to put the character format on the XAXIS  VALUESFORMAT option.  Putting the format on the data set variable will cause the formatted values of "a" and "b" to be merged as one category value.

View solution in original post


All Replies
Super User
Posts: 20,219

Re: SGPLOT - Multiple reference lines with blank label

Try setting one as a space and the second as a '09'x which is a tab?

SAS Super FREQ
Posts: 1,184

Re: SGPLOT - Multiple reference lines with blank label

[ Edited ]

Non breaking spaces 'A0'x (aka nbsp) can be used to create character strings that remain distinct and invisible. 

A string with one nbsp or more nbsps can be used.  Easy way to do this is to put a "." and a ".." in the column, then use translate() function to replace the "." with a 'A0'x.

 

https://blogs.sas.com/content/graphicallyspeaking/2012/09/03/doing-more-with-nbsp/

 

Solution
‎10-15-2017 02:37 PM
SAS Super FREQ
Posts: 1,184

Re: SGPLOT - Multiple reference lines with blank label

[ Edited ]
Posted in reply to Sanjay_SAS

With 9.40M3 (I did not check if this works with earlier releases) you can use a character format to do the same.  Keep the unique values in the category variable (like "a" and "b"), and then use a character format to format these to blank.  It is important to put the character format on the XAXIS  VALUESFORMAT option.  Putting the format on the data set variable will cause the formatted values of "a" and "b" to be merged as one category value.

Occasional Contributor
Posts: 6

Re: SGPLOT - Multiple reference lines with blank label

Posted in reply to Sanjay_SAS
This appears to have solved my problem! XAXIS VALUESFORMAT seems to be exactly what I needed, as it avoids the problem of the formatted values becoming merged together, which, as you mentioned, happens if you use a regular format statement. Thanks so much for your help!
SAS Super FREQ
Posts: 1,184

Re: SGPLOT - Multiple reference lines with blank label

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 179 views
  • 4 likes
  • 3 in conversation