11-08-2016 06:39 AM
I have a DATASET with 4000 variables.
Some of them have a prefixes like these:
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.
11-08-2016 09:15 AM
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...
11-08-2016 10:15 AM
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?
11-08-2016 11:09 AM
This post has many of the prefixes that EM uses that you should try to avoid:
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...