Is SGPANEL considered a SAS/GRAPH or ODS Graphics function?
Thank you!
It's in ODS Graphics. It's part of BASE SAS.
If I have an SGPANEL, how can I convert to SGPLOT?
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?
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;
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;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.