This could work if you run it when EG is using a local SAS installation as a server.
Chances are that your site prefers that you work directly with mainframe SAS. In this case, your EG session should login via a SAS metadata server, and your code will run in a SAS workspace server, on the mainframe.
I suggest that you contact your SAS admin on the mainframe for connection details.
Please confirm if your SAS signon program is being run on the same SAS server or not for both the "normal SAS session" and your EGP version. If you are not running this program on the same servers then you could get different results.
I'm not very knowledgeable on this but my colleagues have told me that SAS/Connect (which is what does the signon) doesn't play well with the Integration Technologies used by Enterprise Guide. If you don't get it working quickly, you should probably throw it to Tech. Support.