Hello
Here are 3 ways how to score a new data
I want to ask please about way3-
store work.MSRP_Model;
As I understand a binary temporary file is created.
Where can I see this file? in work library?
How can I create it in a permanent library?
/*****HOW TO SCORE NEW DATA*****/
/*****HOW TO SCORE NEW DATA*****/
/*****HOW TO SCORE NEW DATA*****/
/*****WAY1***/
/*****WAY1***/
/*****WAY1***/
proc reg data=sashelp.cars outest=model_tbl;
PredMSRP: model msrp = horsepower mpg_city weight;
run;
/*We created data set called model_tbl**/
proc surveyselect data=sashelp.cars out=to_score_tbl(drop=numberhits) n=10
m=urs seed=12345;
run;
/*We created data set called to_score_tbl**/
proc score data=to_score_tbl score=model_tbl type=parms predict out=new_pred;
var horsepower mpg_city weight;
run;
/*We created data set called new_pred**/
/*****WAY2***/
/*****WAY2***/
/*****WAY2***/
%let Path = /usr/local/SAS/SASUsers/LabRet/UserDir/udclk79/Example.sas;
proc reg data=sashelp.cars;
model msrp = horsepower mpg_city weight;
code file="&Path";
run;
/**We didnt create a dataset**/
proc surveyselect data=sashelp.cars out=to_score_tbl(drop=numberhits) n=10
m=urs seed=12345;
run;
/*We created data set called to_score_tbl**/
data new_pred;
set to_score_tbl;
%include "&Path";
run;
/*We created data set called new_pred**/
/*****WAY3***/
/*****WAY3***/
/*****WAY3***/
proc delete data=work._all_;Run;
proc reg data=sashelp.cars;
model msrp = horsepower mpg_city weight;
store work.MSRP_Model;
run;
/*binary file will be saved to a SAS library*/
/*It is better to save this to a permanent location, rather than a temporary location used in this example*/
proc surveyselect data=sashelp.cars out=to_score_tbl(drop=numberhits) n=10
m=urs seed=12345;
run;
/*We created data set called to_score_tbl**/
proc plm restore=work.MSRP_Model;
score data=to_score_tbl out=new_pred;
run;
There's no reason to LOOK AT this item store named WORK.MSRP_MODEL. According to the documentation, "An item store is a binary file format that cannot be modified by the user." Looking at a binary file is really pointless. If you really want to convince yourself that it exists after you run PROC REG, you can use the code below. That same link shows how to store it in a permanent library.
proc datasets library=work;
run; quit;
What "binary" file are you talking about?
You first step is storing the estimated coefficients into the dataset model_tbl. Which your PROC SCORE step uses to calculate predicted values for the new data.
If you want the datasets stored in some library other than WORK then use a TWO LEVEL name, just like you used to reference the dataset SASHELP.CARS in the first step of your program.
You can use a LIBNAME statement to make a new libref if you need one.
There's no reason to LOOK AT this item store named WORK.MSRP_MODEL. According to the documentation, "An item store is a binary file format that cannot be modified by the user." Looking at a binary file is really pointless. If you really want to convince yourself that it exists after you run PROC REG, you can use the code below. That same link shows how to store it in a permanent library.
proc datasets library=work;
run; quit;
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.
Ready to level-up your skills? Choose your own adventure.