BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Jonison
Fluorite | Level 6

Hello, this gives me a headache

 

I need to do multiple responses PLS, and use sas code node for that.

 

Before 'sas code node' it is a 'transform variables' which includes all of specific data treatment.

 

When I edit the code editor, I can see all of data is within the .

 

so I type below:

 

%global xvars yvars;
%let xvars = BLK1 BLK2 BLK3 BLK4 BLK5....; (Long variable list) 
%let yvars = y1 y2 y3 y4; (BLK1.... and y1... are all included in EM_IMPORT DATA.
PROC PLS CV=ONE MISSING=AVG METHOD=PLS NOCENTER NOSCALE NOCVSTDIZE NFAC=6 DATA=&EM_IMPORT_DATA;
model yvars = xvars;
run;

in the log, it shows:

 

ERROR: Variable YVARS not found.
NOTE: The previous statement has been deleted.
7848 run;

ERROR: No MODEL specified

 

I would like to define the variables included in EM_IMPORT DATA as xvars and yvars due to the number of vairables to be used by PLS algorithm,

 

Appreciate your kind help.

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26
model &yvars=&xvars;

Although no macros are needed here, unless the problem is much more complicated than you describe (which may be the case). Code with no macros:

 

model y1 y2 y3 y4 = BLK1 BLK2 BLK3 BLK4 BLK5....; 

You may also need a CLASS statement if any of your X-variables are categorical.

 

--
Paige Miller

View solution in original post

7 REPLIES 7
PaigeMiller
Diamond | Level 26
model &yvars=&xvars;

Although no macros are needed here, unless the problem is much more complicated than you describe (which may be the case). Code with no macros:

 

model y1 y2 y3 y4 = BLK1 BLK2 BLK3 BLK4 BLK5....; 

You may also need a CLASS statement if any of your X-variables are categorical.

 

--
Paige Miller
Jonison
Fluorite | Level 6

Thanks for your kind reply. That works.

can I ask how to use the OUTPUT statement?

The help document is a bit confusing to me, how can I output predict y1, y2, y3, y4 separately and passing this to next node?

 

Many thanks

PaigeMiller
Diamond | Level 26

@Jonison wrote:

Thanks for your kind reply. That works.

can I ask how to use the OUTPUT statement?

The help document is a bit confusing to me, how can I output predict y1, y2, y3, y4 separately and passing this to next node?

 

Many thanks


output out=datasetname predicted=pred_y1 pred_y2 pred_y3 pred_y4;
--
Paige Miller
Jonison
Fluorite | Level 6

thanks for your kind help. 

 

I typed 'output out=&EM_EXPORT_TRAIN predicted=pred_STD_FP_1_5 pred_STD_FP_3_4 pred_STD_SX_1_5 pred_STD_SX_3_4 pred_STD_FP_SX_FPM_Ratio;'

 

and when run code: shows ERROR: Unable to create EMWS2.EMCODE_TRAIN.DATA because EMWS2.EMCODE_TRAIN.VIEW already exists

 

and I would like to make predicted results shown in the emport table of this node. How could I do that? 

 

Thank you very much

 

PaigeMiller
Diamond | Level 26

In a SAS library, you can't have a view and a data set with the same name. Since you already have a view by that name, you have to name the data set something else, or first delete the view.

--
Paige Miller
Jonison
Fluorite | Level 6

thanks, that helps. Would you please suggest that how to append all of prediction results with the existing dataset? which function should I use?

 

Many thanks

PaigeMiller
Diamond | Level 26

PROC APPEND

--
Paige Miller

SAS Innovate 2025: Call for Content

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 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 1195 views
  • 0 likes
  • 2 in conversation