BookmarkSubscribeRSS Feed
mal6508
Calcite | Level 5

Here is some code, intended to take a dataset, apply a marker variable called "selected" which identifies records lacking a sale price as test data, and then use the rest of the data to create a model to predict saleprice values.  This much seems to work.  I also would like the procedure to use the test data to perform a test on the model thus created, but this does not seem to work, and I can't figure out why.

 

data dt;
set miout2 (obs=1670);
if saleprice=. then selected=0; else selected=1;
run;

ods graphics on;

proc glmselect data=dt plots=all;
   partition rolevar=selected(test='0' train='1');
   class [lots of variables];
   model saleprice = [even more variables]
       / selection =lar(choose=cv stop=none) cvmethod=random(10) details=all;
run;

2 REPLIES 2
PaigeMiller
Diamond | Level 26

@mal6508 wrote:

Here is some code, intended to take a dataset, apply a marker variable called "selected" which identifies records lacking a sale price as test data, and then use the rest of the data to create a model to predict saleprice values.  This much seems to work.  I also would like the procedure to use the test data to perform a test on the model thus created, but this does not seem to work, and I can't figure out why.


I know you are new here, @mal6508 , but saying something doesn't work, and then not explaining, never is helpful. We don't know what didn't work and so we can't tell you what to do to make it work. You need to SHOW US what the problem is.

 

If there are errors in the log, then SHOW US the log for the step (DATA step or PROC) that didn't work. We need to see the entire log for that step, not selected parts of the log. We need to see every line in the log for that step, every single line, every single character. Copy the log for that step as text and it into your reply by clicking on the </> icon and paste it into the window that appears.

 

2021-11-26 08_27_29-Reply to Message - SAS Support Communities — Mozilla Firefox.png

 

If the output doesn't seem right to you, then SHOW US the output (screen capture is fine), and explain why you think it is wrong and explain what you think the right answer should be.

--
Paige Miller
sbxkoenk
SAS Super FREQ

Hello,

 

Seconding with @PaigeMiller .

 

Also ... I cannot see anything wrong at first sight, but you may double-check with the documentation :

SAS® 9.4 and SAS® Viya® 3.5 Programming Documentation | SAS 9.4 / Viya 3.5
SAS/STAT User's Guide
The GLMSELECT Procedure
https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/statug/statug_glmselect_overview01.htm

 

Cheers,

Koen

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 509 views
  • 2 likes
  • 3 in conversation