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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 259 views
  • 2 likes
  • 4 in conversation