SGPANEL SGSCATTER group option only creating one output

Accepted Solution Solved
Reply
New Contributor
Posts: 3
Accepted Solution

SGPANEL SGSCATTER group option only creating one output

Hello,

I am using SAS EG and seem to be having a problem with the group option when trying to plot with either SGPANEL or SGSCATTER. I am trying to create a paneled output with scatter plots in each panel. Here is my code:

title1 "Oil Percent";

proc sgpanel data=work.set9766

  (WHERE=(More_Data = 0 AND Vib_scrub = '' AND Moving_Scrub = '')) ;

panelby id_lens / ;

scatter x=last_updated_date y=oil_percent / ;

run;

As you can see I am trying to group by Id_lens, which should have 6 different values, for whatever reason I am getting the 6 different panels in my output but there is only one plot, and that plot has a value for Id_lens that is not in my data set.

Here is what my output looks like:

Capture.PNG

I have seen a couple similar issues out there but have been unable to solve this problem, any information is much appreciated.

Thanks.


Accepted Solutions
Solution
‎05-13-2015 03:39 PM
Grand Advisor
Posts: 10,251

Re: SGPANEL SGSCATTER group option only creating one output

Your current graph is showing an extremely small value. Perhaps the difference is so small that the format SAS is using for a display format all display the same. If you display those other values with a best6 format do they all appear the same as that displayed in the graph.

If that is the case you may need to create a custom format that displays different text for each value.

View solution in original post


All Replies
Grand Advisor
Posts: 10,251

Re: SGPANEL SGSCATTER group option only creating one output

Since you have excluded records based on 3 other variables I would run proc freq on the same data with that where clause for your ID_lens variable to see if there actually are other values for ID_lens within that subset of the data.

Also, if your variable ID_lens has a format associated with it that groups values to that 2.02E8 value you could use a different format in the SGPANEL code such as:

format ID_lens best6.;

New Contributor
Posts: 3

Re: SGPANEL SGSCATTER group option only creating one output

Yes I am sure there is more than one value for ID_lens even after all the filters are applied. When I create the graphs with GPLOT they work fine but for some reason not with SGPANEL. I think there might be some kind of issue with my ODS graphs or something. This problem seems to be very similar to what is happening for me but this still didn't fix my problem 45544 - Grouped line plots generated with PROC SGPLOT or PROC SGPANEL might contain only one plot li...

Solution
‎05-13-2015 03:39 PM
Grand Advisor
Posts: 10,251

Re: SGPANEL SGSCATTER group option only creating one output

Your current graph is showing an extremely small value. Perhaps the difference is so small that the format SAS is using for a display format all display the same. If you display those other values with a best6 format do they all appear the same as that displayed in the graph.

If that is the case you may need to create a custom format that displays different text for each value.

New Contributor
Posts: 3

Re: SGPANEL SGSCATTER group option only creating one output

I converted this value into a text value to test this theory and you are correct. Thanks you for your help.

Do you by any chance know how to change the format that the graph reads rather than having to convert into text?

Grand Advisor
Posts: 10,251

Re: SGPANEL SGSCATTER group option only creating one output

A custom format should work. Something like:

proc format;

value smallstuff /* or what ever makes sense*/

/* use discrete values that actually appear in your data and appropriate text assignment*/

/* Note: the order the values appear will be lexical so '11' would appear before '2'*/

0.0000000200 ='2.00E8'

0.0000000210 ='2.10E8'

0.0000000212 ='2.12E8'

;

run;

and in the proc code include the line:

format  Id_lens smallstuff.;

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 314 views
  • 0 likes
  • 2 in conversation