BookmarkSubscribeRSS Feed
rmlmrmlm
Obsidian | Level 7

I have a DATASET with 4000 variables.

 

Some of them have a prefixes like these:

W_

B_

P_

R_

 

Entreprise Miner metadata nodes automatically sets a role for these variables, according to its prefix:

W_ as Assessment role

B_ as Segment role

(...)

 

This is very boring because I have to change the role manually of about 800 variables.

 

I can't find a list with pre-defined prefixes.

 

Can someone help me, please?

 

Thank you very much.

3 REPLIES 3
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Well, I don't know this Enterprise Miner application however in Base SAS the below code should work.  I would point out of course that 4000 variables isn't a very good structure, in fact much over 20 or 30 variables is a real pain to work with.

data _null_;
  set sashelp.vcolumns (where=(libname="<your lib>" and memname="<your dataset>" and scan(name,1,"_") in ("W","B","P","R"))) end=last;
  if _n_=1 then call execute('proc datasets nolist lib=<your_lib>;  modify <your dataset>;');
  call execute(cat(' rename ',name,'=',tranwrd(name,"_","x"),';'));
  if last then call execute(' quit;run;');
run;

This generates a datasets procedure call with each variable with W_ B_ etc. prefix and renames them to Wx... Bx... 

rmlmrmlm
Obsidian | Level 7

Thank you RW9.

 

I'm going to try your code to rename the variables.

 

However, I insist: is there any document that describes the prefixes we shouldn't use in SAS variables, to avoid conflits in SAS Entreprise Miner Nodes?

 

Thank you!

WendyCzika
SAS Employee

This post has many of the prefixes that EM uses that you should try to avoid:

https://communities.sas.com/t5/SAS-Communities-Library/Scoring-Series-Part-2-SAS-Enterprise-Miner-Sc...

 

Also, you might want to look at this post to see how to use metacode.sas to set the roles/levels for your variables programmatically for all variables with a certain prefix (instead of renaming your variables): https://communities.sas.com/t5/SAS-Communities-Library/Tip-Defining-Global-Metadata-for-SAS-Enterpri...

 

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!

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
  • 3 replies
  • 1223 views
  • 0 likes
  • 3 in conversation