the following code was running without a hitch, then suddenly it started to hang, i left it running over night and it still didn't complete (i've removed any detail that might be sensitive):
ods listing gpath="...";
ods graphics on / reset=all imagefmt=tiff reset imagename="..."
outputfmt=tiff width=2500px height=2000px maxobs=2074738 antialiasmax=112600 ;
ods html close;
title1 j=c h=3 "...";
title2 ;
title3 ;
footnote1 " ";
footnote2 " ";
footnote3 j=l h=1.5 "...";
footnote4 j=l h=1.5 "....";
proc sgplot data=plot;
format plotcat plotcat_f.;
styleattrs datacontrastcolors=(blue lightblue red pink);
series x=... y=... / group=... grouporder=ascending
lineattrs=(thickness=4 pattern=solid)
name='s';
series x=... y=... / group=... grouporder=ascending
lineattrs=(thickness=4 pattern=dash) ;
yaxis values=(... to ... by ...)
label='....'
offsetmax=0.05 offsetmin=0.05
labelattrs=(color=black family=Arial Size=18 style=normal )
valueattrs=(color=black family=Arial Size=15 style=normal ) ;
xaxis values=(...)
valuesdisplay=(....)
label='...' offsetmax=0.05 offsetmin=0.05
labelattrs=(color=black family=Arial Size=18 style=normal )
valueattrs=(color=black family=Arial Size=15 style=normal ) ;
refline 1 / ;
keylegend 's' / title="" linelength=2cm noborder
valueattrs=(color=black family=Arial Size=15 style=normal )
titleattrs=(color=black family=Arial Size=18 style=normal )
location=outside position=bottom down=2;
run;
quit;
ods graphics off;
i had to keep terminating the sas session and try again. After tinkering with the code i noticed it runs successfully when I remove this bit:
width=2500px height=2000px maxobs=2074738 antialiasmax=112600
i'm not sure why this would suddenly pose a problem. My computer has 64GB RAM, so it's not a resource issue. My sas profile looks 'healthy' (ie the file size hasn't blown up which can happen when corrupted). When i remove the offending line of code the tiff figure is too small to be usable. Any idea how i can solve this issue, ie generate a useful figure and diagnose the sudden problem I'm confronted with? I use sgplot a lot and I don't believe I've ever experienced this. cheers
it seems it didn't run because the values in one of the series were extreme, ie well outside the range specified for the y-axis. I expect it to throw a warning in the log in this case however, and not simply hang. But when i removed the series with extreme values, or corrected the extreme values to bring them in line with the other series, then the code ran swiftly without a problem. I thought this is worth noting
Interesting result. Thanks for reporting what you found. So that we can try to reproduce this problem, can you tell us
1. Which variable (x, y, or group) is the formatted variable, PLOTCAT?
2. I assume you have 2 million observations, but how many line segments? (Count the distinct values of the GROUP= variable.)
Of the options in your ODS GRAPHICS statement, the expensive one is the one that enables ANTIALIASing for many many line segments. I'd be curious if the program hangs if you remove that one option while keeping the extreme, out-of-range observations.
cheers for the reply Rick. The format applies to the group variable and it has 8 categories. 4 of the categories (or lines in the plot) correspond to the first series and were okay, the other 4 caused the problem. I should say: I am plotting hazard ratios; in the first series they were between maybe 0 and 2, but in the second series some might have exceeded 1000 owing to a miscalculation (when i used the hazardratio statement in phreg, instead of calculating by hand, the problem was resolved, sgplot ran because the HRs were now sensible values)
i think my use of " ANTIALIASing" was superfluous here and a hangover from other code that i'd copied across. Unfortunately i'm unable to test your hypothesis because the code was further developed and no longer producing the extreme values
edit: the reason i suspect the extreme values are to blame is because sgplot ran fine, even with antialiasing, until i modified the equations for HRs which i suspect blew out the estimates, and then sgplot hung
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.