Building models with SAS Enterprise Miner, SAS Factory Miner, SAS Visual Data Mining and Machine Learning or just with programming

Pre-defined prefixes Entreprise Miner

Reply
Contributor
Posts: 22

Pre-defined prefixes Entreprise Miner

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.

Super User
Super User
Posts: 7,392

Re: Pre-defined prefixes Entreprise Miner

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... 

Contributor
Posts: 22

Re: Pre-defined prefixes Entreprise Miner

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!

SAS Super FREQ
Posts: 269

Re: Pre-defined prefixes Entreprise Miner

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...

 

Ask a Question
Discussion stats
  • 3 replies
  • 220 views
  • 0 likes
  • 3 in conversation