BookmarkSubscribeRSS Feed
rakul
Fluorite | Level 6

Hi All,

I have my SAS code as below and need few changes here to get the desired output (image attached).

Request community to make necessary changes to get desired output. Thanks!

 

My requirements:

  1. need to update the range of the x-axis to be 50-100
  2. I want to Change the circle into a triangle for dot_value=SUN; make it slightly larger than the pies and color it red
  3. Just before the 2-headed arrow lines, write the citation (dot_count) for dot_value=SUN in 2019 and enclose in brackets.
  4. i want to add an x-axis for reference below the chart


libname test ' C:\Test';
%let length=function $8. ;

proc sql;
create table prep_fac as
select distinct fac_order, fac_label
from test.driver
;
quit;

data anno_line;
length &length.;
set prep_fac;
function='arrow';drawspace='datavalue';
x1=0;y1=fac_order;
x2=100;y2=y1;
direction='both';linecolor='grey';linethickness=1;shape='filled';linepattern='1';
output;
run;

data anno_label;
length &length.;
set prep_fac;
function='text';x1space='graphpercent';y1space='datavalue';
x1=1;y1=fac_order;
label=strip(fac_label);width=100;
justify='left';textcolor='black';textsize=20;textfont='Calibri';anchor='left';
output;
run;

data anno_dot;
length &length.;
set test.driver;
where year="2019";
function='oval';drawspace='datavalue';
x1=dot_value;y1=fac_order;height=10;width=height;
heightunit='pixel';widthunit='pixel';
fillcolor=color_f;display='all';
output;
run;

data anno;
set
anno_line
anno_label
anno_dot
;
run;

ods html path = "C:\Test"
gpath = "C:\Test"
file = "Test.html";
ods graphics on / imagefmt = gif;
ods graphics on / width=1800px height=1100px;
ods graphics on / reset=index imagename = "Kebab";

data temp;
a=0;b=10; output;
a=10;b=0; output;
run;

proc sgplot data=temp sganno=anno noborder;
scatter x=a y=b;
xaxis min=0 max=100 display=none offsetmin=0.3 offsetmax=0.05;
yaxis min=1 max=8 display=none offsetmin=0.05 offsetmax=0.05;
run;

ods _all_ close;

4 REPLIES 4
ChrisNZ
Tourmaline | Level 20

1. Please provide data we can use to run the code

2. Post the code using the appropriate icon (above the text box) so it is formatted properly

3. Do not attach MS office files. For images, there also is a dedicated icon.

 

rakul
Fluorite | Level 6
@ChrisNZ Thanks for the response! Please find below.

My requirements:

  1. need to update the range of the x-axis to be 50-100
  2. I want to Change the circle into a triangle for dot_value=SUN; make it slightly larger than the pies and color it red
  3. Just before the 2-headed arrow lines, write the citation (dot_count) for dot_value=SUN in 2019 and enclose in brackets.
  4. i want to add an x-axis for reference below the chart


libname test ' C:\Test'; %let length=function $8. ; proc sql; create table prep_fac as select distinct fac_order, fac_label from test.driver ; quit; data anno_line; length &length.; set prep_fac; function='arrow';drawspace='datavalue'; x1=0;y1=fac_order; x2=100;y2=y1; direction='both';linecolor='grey';linethickness=1;shape='filled';linepattern='1'; output; run; data anno_label; length &length.; set prep_fac; function='text';x1space='graphpercent';y1space='datavalue'; x1=1;y1=fac_order; label=strip(fac_label);width=100; justify='left';textcolor='black';textsize=20;textfont='Calibri';anchor='left'; output; run; data anno_dot; length &length.; set test.driver; where year="2019"; function='oval';drawspace='datavalue'; x1=dot_value;y1=fac_order;height=10;width=height; heightunit='pixel';widthunit='pixel'; fillcolor=color_f;display='all'; output; run; data anno; set anno_line anno_label anno_dot ; run; ods html path = "C:\Test" gpath = "C:\Test" file = "Test.html"; ods graphics on / imagefmt = gif; ods graphics on / width=1800px height=1100px; ods graphics on / reset=index imagename = "Kebab"; data temp; a=0;b=10; output; a=10;b=0; output; run; proc sgplot data=temp sganno=anno noborder; scatter x=a y=b; xaxis min=0 max=100 display=none offsetmin=0.3 offsetmax=0.05; yaxis min=1 max=8 display=none offsetmin=0.05 offsetmax=0.05; run;
ods _all_ close;
output.png

 

rakul
Fluorite | Level 6

final output should be like this. Please help to edit the code to get required output.output.png 

ChrisNZ
Tourmaline | Level 20

Moved to graphics community , hoping you'll get help there

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 988 views
  • 0 likes
  • 2 in conversation