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

Edit Using SAS Code Seems to Not Work

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 115
Accepted Solution

Edit Using SAS Code Seems to Not Work

I pepare my data in Enterprise Guide then save it out into a directory to be later read into Enterprise Miner. There are a lot of variables where I would like to set varying parameters. Below are a few examples:

* if Role = "TIMEID" then Level = "INTERVAL";

Role = "INPUT";

if Name = "TRENDED_INCURRED" then Role = "TARGET";

* Making all of the Text Flag fields Nominal;

TEXT_ID = index(Name, "Flag");

if TEXT_ID = 1 then Level = "Nominal";

* Dropping all of the Date variables;

if Role = "TIMEID" then Drop = "Y";

* Changing the following vars to Nominal - some ORDINAL sprinkled in as well for HAZARDC0DE;

if Name = MAXTOTALCODE then Level = Nominal;

if Name = DOCTORS then Level = Nominal;

You can see that I commented out some of my statements as well - do not know if Edit Using SAS Code likes this. If I recall correctly Enterprise Miner can be a little quirky where sometimes it does not like blank lines, or stuff like that.

If I am in the window of editing the SAS code everything looks fine. But when I say OK and re-open my SAS data file in Miner it shows a lot of weird changes or many changes that are just left blank.

Is anything wrong with my version of Miner? But, my big question is if I can set the variable Levels, Roles, and Drop statuses in Enterprise Guide before it is read into Enterprise Miner?

Thank you very much in advance.


Accepted Solutions
Solution
‎08-14-2015 09:37 AM
SAS Super FREQ
Posts: 306

Re: Edit Using SAS Code Seems to Not Work

That's correct about upper-casing the values for the variable measurement levels and roles.  But comments and blank lines should be allowed, so not sure why that is causing problems for you.  There are some other ways you can define metadata described in this Tip on Defining Global Metadata for SAS® Enterprise Miner™ Projects that might be of interest:

https://communities.sas.com/docs/DOC-11122

View solution in original post


All Replies
Community Manager
Posts: 2,954

Re: Edit Using SAS Code Seems to Not Work

Zach, you might be able to use the Recode Variables feature in the EG Query Builder to accomplish what you want.  In the Query Builder, go to Computed Columns, New, then select Recoded Column.  You'll have a few choices for how you express the recoding rules.  There's an article that covers a simple example here in this SAS note.

Also, Dr. AnnMaria shares this experience for how to fix character data without the beatings.

Chris

Frequent Contributor
Posts: 115

Re: Edit Using SAS Code Seems to Not Work

Posted in reply to ChrisHemedinger

Thank you very much Chris. I love the Dr. AnnMaria blog as well - will be visiting that occasionally - she is very funny.

I THINK I have figured out how to effectively use Edit Using SAS Code for the Edit Variables window. Below are some suggestions:

I do not think the system likes comments - either via *; or /* */.

Nor do I think it wants blank lines in there.

This might be a place in SAS where it is important to capitalize key words. So if I set my Level to Nominal, it actually needs to be NOMINAL even though it does not show as all Caps in the window.

I need to experiment more with this one, but I once thought it was important to have a run; after a set of code. But I am not so sure anymore.

They are not much - but following those steps seems to help the process move along in an automated way.

Anything else I might have missed?

Solution
‎08-14-2015 09:37 AM
SAS Super FREQ
Posts: 306

Re: Edit Using SAS Code Seems to Not Work

That's correct about upper-casing the values for the variable measurement levels and roles.  But comments and blank lines should be allowed, so not sure why that is causing problems for you.  There are some other ways you can define metadata described in this Tip on Defining Global Metadata for SAS® Enterprise Miner™ Projects that might be of interest:

https://communities.sas.com/docs/DOC-11122

Frequent Contributor
Posts: 115

Re: Edit Using SAS Code Seems to Not Work

Posted in reply to WendyCzika

Thanks a bunch. Will look into if my comments were more a result of a panic.

Actually - thank you for the link. I now have numerous options in how I can make my data meaningful! Thank you so much!

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 522 views
  • 4 likes
  • 3 in conversation