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;
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.