HI ,
can anyone please give some example code for the vertical bar graph with circles plotting on it.
Thanks,
Mahesh
data testdata; length city $9; city = "London"; dollar = 50; scatter = 45; output; city = "Dubai"; dollar = 40; scatter = 35; output; city = "New York"; dollar = 20; scatter = 25; output; city = "Las Vegas"; dollar = 60; scatter = 30; output; run; proc sgplot data=testdata noautolegend; vbar city/response=dollar; vline city/response=scatter LINEATTRS=(thickness=0) MARKERATTRS=(size=20 symbol=circlefilled color=orange) markers; run;
x-axis with description of city , y axis with dollar, right side with no of assigned clients
Hello,
Here is some example code that you can use:
data testdata;
length city $9;
city = "London"; dollar = 50; scatter = 45; output;
city = "Dubai"; dollar = 40; scatter = 35; output;
city = "New York"; dollar = 20; scatter = 25; output;
city = "Las Vegas"; dollar = 60; scatter = 30; output;
run;
proc template;
define statgraph barwithcircle;
begingraph;
layout overlay;
barchart x = city y = dollar;
scatterplot x = city y = scatter / markerattrs = (size = 20 color = orange symbol = circlefilled);
endlayout;
endgraph;
end;
run;
proc sgrender data = testdata template = barwithcircle;
run;
The code produces the graph below.
proc sgplot data=testdata;
vbarparm category = city response=dollar; *bar graph;
scatter x= city y=clients / y2axis; *scatter plot;
run;
See the section in the docs titled Basic-Compatible Bar Chart Examples for various other examples here
@pmksasbi wrote:
x-axis with description of city , y axis with dollar, right side with no of assigned clients
thank you all
You're welcome. I also believe that my answer should have been marked as the solution since I created the data and answered it first.
i am sorry, since i marked it . i am unable to make any changes
@pmksasbi wrote:
i am sorry, since i marked it . i am unable to make any changes
Actually it can ben updated, click the three dots beside the post currently marked as solved.
@djrisks As to which solution to mark as correct - the OP should mark the solution that best fits their needs, ie if the SGPLOT solution is simpler that is a valid selection over an SGRENDER solution.
data testdata; length city $9; city = "London"; dollar = 50; scatter = 45; output; city = "Dubai"; dollar = 40; scatter = 35; output; city = "New York"; dollar = 20; scatter = 25; output; city = "Las Vegas"; dollar = 60; scatter = 30; output; run; proc sgplot data=testdata noautolegend; vbar city/response=dollar; vline city/response=scatter LINEATTRS=(thickness=0) MARKERATTRS=(size=20 symbol=circlefilled color=orange) markers; run;
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.