Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

SAS Software question I need to create a linear regression plot using the REG st

ID: 3871726 • Letter: S

Question

SAS Software question

I need to create a linear regression plot using the REG statement in PROC SGPLOT with height as the x variable and weight as the y variable. Make the symbols circles that are filled in, but assign different colors according to the sex variable using the GROUP option in the SCATTER statement. Now that the data is grouped, separate regression lines will be plotted for each sex. Also display the confidence band for regression lines and set the transparency level of the band to be 0.5;

This is what I've got but the transparency is not acting on the confidence band
proc sgplot data=sashelp.class;
reg x= height y=weight / group=sex markerattrs=(symbol=circlefilled)
                       CLM transparency=0.5;
run;

Explanation / Answer


Create the scatter plot. In the SCATTER statement, the GROUP= option groups the data by the TYPE variable. The GROUPDISPLAY option specifies that the grouped markers are clustered. The CLUSTERWIDTH option specifies the width of the group clusters.
proc sgplot data=sashelp.revhub2; scatter x=hub y=revenue / group=type groupdisplay=cluster clusterwidth=0.5; xaxis type=discrete; run;