I want to create graphics in SAS/IML using sgplot in a submit/endsubmit block. my ODS GRAPHICS statement and additional SGPLOT statements are:
submit table_title ;
ods graphics on / border=on height=8in ;
title &TABLE_TITLE ;
proc sgplot data=subset_data ;
series x=Index y="Fuzzy Entropy"n / datalabel="Variable Name"n datalabelpos=top markers ;
xaxis label='Index' ;
yaxis label='Fuzzy Entropy' ;
run ;
ods graphics off ;
endsubmit ;
When I run the code, the SGPLOT statements execute correctly but the graph created is not 8 inches high. What am I doing wrong? Or do I need to add ODS LISTING statements such as:
ods listing gpath='/home/rsbettinger/FuzzyFeatSel' IMAGE_DPI=300 style=journal;
ods graphics/ outputfmt=pdf ;
ods graphics on / height=8in;
to get the results that I want, e.g., an elongated y-axis that will stretch out the space required to display the labels in the datalabel variable?
Don't turn off ODS GRAPHICS at the end of the SUBMIT block:
proc iml;
table_title = "My Title";
submit table_title ;
ods graphics / border=on height=7in ;
title &TABLE_TITLE ;
proc sgplot data=sashelp.class ;
series x=Weight y=Height / datalabel=Age datalabelpos=top markers ;
xaxis label='Index' ;
yaxis label='Fuzzy Entropy' ;
run ;
endsubmit ;
I don't know why ODS GRAPHICS OFF causes the problem. Perhaps the rendering is not complete when the ODS GRAPHICS OFF statement changes the environment, and when the rendering occurs, the options that you set on the ODS GRAPHICS ON statement have been overwritten.
Don't turn off ODS GRAPHICS at the end of the SUBMIT block:
proc iml;
table_title = "My Title";
submit table_title ;
ods graphics / border=on height=7in ;
title &TABLE_TITLE ;
proc sgplot data=sashelp.class ;
series x=Weight y=Height / datalabel=Age datalabelpos=top markers ;
xaxis label='Index' ;
yaxis label='Fuzzy Entropy' ;
run ;
endsubmit ;
I don't know why ODS GRAPHICS OFF causes the problem. Perhaps the rendering is not complete when the ODS GRAPHICS OFF statement changes the environment, and when the rendering occurs, the options that you set on the ODS GRAPHICS ON statement have been overwritten.
Rick,
You hit the nail squarely on the head! Your solution works perfectly and now I can continue with my project. I have enclosed a sample of the output that your solution enabled me to create.
Thank you very much,
Ross
Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.
Explore Now →