in variable selection method to choose the best subset of models. How can I create a plot for cp with p and r adj with p
here is my code for all possible regressions
proc reg data=salary;
model y=x1 x2 x3 x4 x5 x6 x7 x8 x9 x10/
selection=rsquare cp mse adjrsq aic bic best=10 b;
There are two concepts you need to learn.
1. How to capture data from SAS procedures into data sets:
https://blogs.sas.com/content/iml/2017/01/09/ods-output-any-statistic.html
2. How to graph:
http://people.uncw.edu/blumj/stt592/ppt/Introduction%20to%20the%20SGPLOT%20Procedure.pdf
I've posted answers to your questions that was fully coded and illustrated this, and you've posted several questions that are pretty much all examples of this procedure. It's worth spending the day or so to learn these two topics well enough.
Your code currently is a mix of PROC REG and GPLOT, and by that I mean you've mixed up procedures entirely. I do not see a GPLOT statement at all in your code though. I do not use GPLOT so cannot comment on that portion. The general recommendation these days is to not use GPLOT, it's to use SGPLOT because it's easier, graphics are higher quality and there are more graph types and options to customize it.
@shahd wrote:
goptions ctitle=black htitle=3.5pct ftitle=swiss
ctext =magenta htext =3.0pct ftext =swiss
cback =ligr border;
symbol1 v=circle c=red h=1 w=2;
title 'Cp Plot with Reference Lines';
symbol1 c=green;
proc reg data=salary;
model salary=x1 x2 x3 x4 x5 x6 x7 x9 x10
/ selection=rsquare noprint;
plot cp.*np.
/ chocking=red cmallows=blue
vaxis=0 to 15 by 5 cframe=ligr;
run;
I wrote this code and it give me error
I couldnot open the second link of how to graph
This isn't mine, it's from a google search, but appears relatively good.
I couldnot figure it out 😞
Which part? What did you try?
You need to break these down into steps and then try and solve each step individually. If you try and do it all at once you will not get anywhere.
The steps are:
1. Get data from PROC REG into a data set
2. Graph with SGPLOT - customize after base plot is obtained.
FYI - I am more than happy to help but I'm not going to write the code for you - my personal choice. Someone else may, if that's what you want, you can wait and see if someone else responds.
@shahd wrote:
I couldnot figure it out 😞
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: