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
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;
You will probably need this statement inside SGPLOT as well (given your data):
xaxis type=discrete;
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."
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.