0
votes

My department uses syscc to trap errors and warnings. Most of the time this is really helpful, however, I’ve either run into a very strange bug, or I’m doing something wrong.

The code below creates some data then plots 2 charts. The latter “%put &syscc;” – where title1 is set to a string 42 characters long - returns a value of 4, but “%put &syswarningtext;”doesn’t return anything, and Enterprise guide doesn’t identify it as a warning.

  • ETA NB:The same behavious is seen in both Enterprise guide and the stored process web app.
  • ETA NB:Because of the better handling of busy axes, we need to output to ActiveX.
    data test;
       length x y 8;
       infile datalines dsd;
       input x y;
        datalines;
        1,1
        2,2
        ;
    run;
    
    TITLE1 'This is forty one characters long. Honest';
    PROC GPLOT DATA = WORK.test;
        PLOT y * x; 
    run; quit; 
    %put &syscc;
    %put &syswarningtext;
    
    TITLE1 'This however, is forty two characters long';
    PROC GPLOT DATA = WORK.test;
        PLOT y * x; 
    run; quit; 
    %put &syscc;
    %put &syswarningtext;
    

    I’ve done some investigation and determined a few things -

    • The value is set on the exit of gplot (either on hitting a quit or a subsequent data step).
    • The Linesize option is set to 132, so it’s not that.
    • It isn’t affected by the width of the chart - I thought it might be affected by the ability to fit the title over the chart.

    Any thoughts? (NB Already submitted to SAS support. Race!)

    *****************EDIT********************

    Further investigation, prompted by Joe's answer below. It seems that one of the things that "goptions reset=all;" does is change the device from activeX to blank. While this fixes the title problem, it causes the real chart (but not the example) to throw other errors since it has a somewhat congested x-axis. It would be great to get both working. In the meantime, I think we will have weirdly short titles.

    *****************EDIT2*******************

    SAS Support have opened a (very small, low priority) defect about this. My first SAS bug!

  • 1

    1 Answers

    0
    votes

    I'm not sure of the direct cause, but it seems like it can be solved by adding

    goptions reset=all;
    

    to the top of the program (or, before any PROC GPLOT statements) (and of course adding back your necessary elements). This is in EG 6.1/SAS 9.4 local.

    It is specific to EG, as it doesn't occur when I run it in base SAS. It occurs with GPLOT and GCHART, but not the ODS Graphics procs (SGPLOT etc.) or regular PROC FREQ.

    I also saw some weird inconsistencies that suggested it's not related to the 41-42 characters precisely; often it would be 0 for my first entire run but then 4 on the start of the second run. It's possible some of this was related to your data step, which I fixed belatedly (it works, but it's not exactly right, and it's possibly related- though certainly not the entire cause).

    I also took out the spurious QUIT; after the gplots, which sometimes seemed to have an effect; another thing that seemed to have an effect was TITLE1; before re-setting the title. But again, the effects were inconsistent, and never persisted to a second running.

    My best guess is that there's a goption somewhere that's not quite handled properly by EG, probably related to the creation of the image file.

    data test;
       infile datalines dlm=',';
       input x y;
        datalines;
        1,1
        2,2
        ;
    run;
    goptions reset=all;
    TITLE1 'This is forty one characters long. Honest';
    
    PROC GPLOT DATA = WORK.test;
        PLOT y * x; 
    run;
    %put &syscc;
    %put &syswarningtext;
    TITLE1 'This however, is forty two characters long';
    PROC GPLOT DATA = WORK.test;
        PLOT y * x; 
    run; 
    %put &syscc;
    %put &syswarningtext;