BookmarkSubscribeRSS Feed
keen_sas
Quartz | Level 8

Hi All,
I have got one reference  graph to create similar output (attached is the graph) , but not sure what type of graphs is it.(assuming it as scatter plot, not sure) . As per the attached graph values on X- axis represents each state code(numeric value) and the y-axis values are percentage of cars present in each state (two different companies X and Y). May i know how the 0% values are represented on above x-axis and vertical lines from 0 to the respective percentages or sometimes the corresponding percentage is in between. Colour represents companies X and Y.
Any sample code/suggestions how to generate this and what this graph is called. Thanks in advance for suggestions

4 REPLIES 4
Reeza
Super User
No idea what it's called but you could create it with a Scatter statement and error bars that have dotted lines.
You could also do two scatter statements and a drop line most likely.

SGPLOT would be where you would start and I'd assume you're starting with aggregate data already.
DanH_sas
SAS Super FREQ

If I were creating this using SGPLOT, here is how I would do it (this following code is just a guideline):

proc sgplot data=wahtever;
refine 25 / lineattrs=(pattern=dot color=red);
refine 13 / lineattrs=(pattern=dot color=black);
highlow x=xvar high=highvar low=lowvar / lineattrs=(pattern=dot color=lightgray);
scatter x=xvar y=highvar / markerattrs=(symbol=circlefilled color=red);
scatter x=xvar y=lowvar / markerattrs=(symbol=square color=black);
text x=xvar y=highvar text=highpct / textattrs=(color=red) position=top pad=(bottom=3px);
text x=xvar y=lowvar text=lowpct / textattrs=(color=black) position=top pad=(bottom=3px);
run;

 

 

DanH_sas
SAS Super FREQ

You will probably need this statement inside SGPLOT as well (given your data):

xaxis type=discrete;

Rick_SAS
SAS Super FREQ

I would call this graph a (vertical) high-low plot. For an overview, see this blog post. For more details about the vertical high-low plot, see "Getting started with SGPLOT: Vertical HighLow Plot."

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 4 replies
  • 803 views
  • 2 likes
  • 4 in conversation