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:
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;
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.
@ChrisNZ Thanks for the response! Please find below.
My requirements:
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;
final output should be like this. Please help to edit the code to get required output.
Moved to graphics community , hoping you'll get help there
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.