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-2024.png

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.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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