/***********************************************************************************************/
/* Run a machine learning procedure with SASHELP.CARS CAS table.                               */
/*                                                                                             */
/* Load SASHELP.CARS if it's not already loaded into CAS. Note that Viya procedures take CAS   */
/* engine libref rather than a caslib.                                                         */                                   
/*                                                                                             */
/* Fill in your value for the following parameter displayed within <> in                       */
/* the code below:                                                                             */
/*   <cas_engine_libref>: Name of the CAS engine lib ref. e.g., mycas                          */
/*   <sashelpcars>: Name of the CAS table with contents of sashelp.cars. e.g., carssashelp     */
/***********************************************************************************************/

%_Get_Studio_SubmissionID_;
rsubmit;

/* Set the ODS parameters on the SAS Viya host */
%_Begin_Viya_ODS_();

proc factmac data=<cas_engine_libref>.<sashelpcars> maxiter=30 nfactors=5 learnstep=0.001;
	target msrp;
	input make model / level=nominal;
	score out=<cas_engine_libref>.facmac_out copyvars=(msrp make model);
run;

/* Download the ODS outputs from the SAS Viya host to SAS 9.4 */
%_End_Viya_ODS_;
endrsubmit;




