BookmarkSubscribeRSS Feed
beatrizlima
Calcite | Level 5

 

I spent quite some time searching for a way to reject variables in SAS Model Studio using code, but I couldn’t find anything that explained it directly. That’s why I’m sharing it here.

It turns out the solution is actually very simple. You can change the role of variables without altering the original dataset or going through Manage Variables.  It’s also much easier to reject dozens of variables this way, instead of manually selecting them one by one in Manage Variables.

Just use the following macro for each variable you want to adjust:

 
%dmcas_metaChange(NAME=var_1, ROLE=REJECTED);

This makes it possible to reuse the same table across different pipelines while still controlling which variables are included or excluded in each specific flow. 

 

beatrizlima_0-1755622439584.png

 

In this image, it is possible to see a simple pipeline that compares two models: one with all variables and the other with some rejected variables.
Hope this helps some one!

 

1 REPLY 1

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

SAS Viya: Coding Simplified

Carleigh Jo Crabtree presents a simplified intro to SAS Viya for programmers.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1105 views
  • 1 like
  • 1 in conversation