BookmarkSubscribeRSS Feed
georgeb7
Calcite | Level 5

Is SGPANEL considered a SAS/GRAPH or ODS Graphics function?

 

Thank you!

5 REPLIES 5
DanH_sas
SAS Super FREQ

It's in ODS Graphics. It's part of BASE SAS.

georgeb7
Calcite | Level 5

If I have an SGPANEL, how can I convert to SGPLOT?

DanH_sas
SAS Super FREQ

It depends on the plot request. Is your goal to produce single plots of each cell in the panel. If so, try just changing SGPANEL to SGPLOT, and changing the PANELBY to BY (removing any options after the "/"). You might still have other plots options that are not compatible. Can you post your procedure code?   

georgeb7
Calcite | Level 5

PROC SGPANEL DATA = d;
PANELBY Q1 / NOVARNAME SPACING = 5;
LOESS X = Q9 Y = Q15 / NOMARKERS CLM NOLEGCLM;
REG X = Q9 Y = Q15;
REFLINE 0 9 / LABEL = ('Strongly Agree' 'Strongly Disagree') TRANSPARENCY = 0.25;
FORMAT Q1 Q1Fmt.;
TITLE1 'Relationship between Stress from Workload and Stress Eating Response';
TITLE2 'For Michigan State University Graduate Students';
FOOTNOTE1 C=BLACK JUSTIFY=CENTER 'Scatter plot of Stress from Workload vs. Stress Eating Response by Sex';
FOOTNOTE2 C=BLACK JUSTIFY=CENTER 'EPI 852 Survey Data';
FOOTNOTE3 C=BLACK FONT=SCRIPT JUSTIFY=RIGHT 'MB BG KV RW';
AXIS1 LABEL=(FONT=SWISS COLOR=RED 'Q9') ORDER = (0 to 10 by 1);
AXIS2 LABEL=(FONT=SWISS COLOR=RED 'Q15') ORDER = (0 to 10 by 1);
RUN;
QUIT;

DanH_sas
SAS Super FREQ

If you want a plot for every cell, the following code should work for you. If you want to fit the entire data set, just remove the BY statement.

 

PROC SGPLOT DATA = d;
BY Q1;
LOESS X = Q9 Y = Q15 / NOMARKERS CLM NOLEGCLM;
REG X = Q9 Y = Q15;
REFLINE 0 9 / LABEL = ('Strongly Agree' 'Strongly Disagree') TRANSPARENCY = 0.25;
FORMAT Q1 Q1Fmt.;
TITLE1 'Relationship between Stress from Workload and Stress Eating Response';
TITLE2 'For Michigan State University Graduate Students';
FOOTNOTE1 C=BLACK JUSTIFY=CENTER 'Scatter plot of Stress from Workload vs. Stress Eating Response by Sex';
FOOTNOTE2 C=BLACK JUSTIFY=CENTER 'EPI 852 Survey Data';
FOOTNOTE3 C=BLACK FONT=SCRIPT JUSTIFY=RIGHT 'MB BG KV RW';
AXIS1 LABEL=(FONT=SWISS COLOR=RED 'Q9') ORDER = (0 to 10 by 1);
AXIS2 LABEL=(FONT=SWISS COLOR=RED 'Q15') ORDER = (0 to 10 by 1);
RUN;
QUIT;

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

Register now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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