Scientific notation values are displayed unexpectedly in the legend of a graph that is created by the SGPLOT procedure


Scientific notation values might be displayed for long numeric values in the legend of a graph that is created by PROC SGPLOT.

If the data value has 6 digits or fewer (for example, id= 121006,121004,121005), the ID variable is grouped and displayed correctly.

However, if the data value has 7 or more digits (for example, id=2121006,2121004,2121005), the ID variable is incorrectly grouped as one with scientific notation (2.12E6).

Supplying a numeric format, of sufficient length, can prevent long numeric values from being written in scientific notation.

The following sample data set and syntax provide an example:

data test;
input t ds id;
datalines;
1 4 2121005
2 5 2121005
3 3 2121006
1 7 2121006
;

proc print data=test;
run;

proc sgplot data=test;
series X=t Y=ds / group=id;
format id 8.;
run;