BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
rbettinger
Lapis Lazuli | Level 10

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

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. 

 

View solution in original post

2 REPLIES 2
Rick_SAS
SAS Super FREQ

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. 

 

rbettinger
Lapis Lazuli | Level 10

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

FuzzyFeatSel_test.png

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 2 replies
  • 1460 views
  • 3 likes
  • 2 in conversation