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

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.

 

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
  • 705 views
  • 0 likes
  • 2 in conversation