Review your metadata profiles using SAS Enterprise Guide automation

We call it the "metadata profile", but really it's like a telephone number that connects you to your SAS environment. Just as a telephone number has component parts (country code, area code, exchange), the metadata profile contains information that allow you to "dial in" to your SAS servers. This information includes:

  • a host name (node name or IP address of your SAS metadata server)
  • a port number (the TCP/IP port that the SAS metadata server uses to accept connections)
  • your credentials (the user ID and password that identify you when you connect)

All of this is captured under a friendly name, which you assign when you define the profile.  This is similar to the way that you would file a colleague's information in your Rolodex (still have that?) or contacts list.

When you're connected to a SAS environment in SAS Enterprise Guide, you'll see some of that profile information reflected in the status bar:

To activate a different profile or to define a new one, you can click on the Connections link in the status bar. This invokes the Connections window, showing all of your available profiles and their details.

The profile name is important, because you can make use of this name as a shortcut (similar to "speed dial") to direct SAS Enterprise Guide to a particular metadata environment automatically.  To learn more, read about how to use SAS Enterprise Guide with different SAS environments.

You can also use the profile name in SAS Enterprise Guide automation scripts, as shown in this example about running SAS programs in batch.

My objective in this blog post (and I'm taking a while to get to it) is to show how to use an automation script to list the available profiles that you have defined for your installation of SAS Enterprise Guide.  In this VBScript program, I use the Application.Profiles collection to obtain the details of each defined profile.  To set an active profile in script, use the Application.SetActiveProfile() method.  Note that if you want to run in "no profile" mode (not connected to metadata, simply using your local SAS installation), you specify "Null Provider" as the profile name.  (Aside: "Null Provider" would make a great name for a rock band, or maybe for a blog.)

Here's the VBScript program:

' force declaration of variables in VB Script
Option Explicit
Dim Application
' Create a new SAS Enterprise Guide automation session
Set Application = WScript.CreateObject("SASEGObjectModel.Application.4.3")
WScript.Echo Application.Name & ", Version: " & Application.Version
' Discover the available profiles that are defined for the current user
Dim i 
Dim oShell
Set oShell = CreateObject( "WScript.Shell" )
WScript.Echo "Metadata profiles available for " _
   & oShell.ExpandEnvironmentStrings("%UserName%")
WScript.Echo "----------------------------------------"
For i = 1 to Application.Profiles.Count-1
  WScript.Echo "Profile available: " _
    & Application.Profiles.Item(i).Name _
    & ", Host: " & Application.Profiles.Item(i).HostName _
    & ", Port: " & Application.Profiles.Item(i).Port

And here's an example of the output:

C:\Examples>cscript ShowProfiles.vbs
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

Enterprise Guide, Version:
Metadata profiles available for sascrh
Profile available: Null Provider, Host: , Port:
Profile available: t2817, Host: t2817, Port: 8562
Profile available: uitsrv02, Host:, Port: 8561
Profile available: uitsrv04, Host:, Port: 8561

tags: automation, SAS Enterprise Guide, scripting, vbscript


  1. Barry Stevens
    Posted February 2, 2012 at 5:45 pm | Permalink

    A good modification to EG is to display the connected profile name somewhere in the status bar rather than the server name as a number of users don't know what server name is what etc.

  2. Barry Stevens
    Posted February 7, 2012 at 3:50 pm | Permalink

    Looking forward to it :)

  3. juanvg1972
    Posted February 23, 2012 at 12:35 pm | Permalink

    I have recently started to read your blog and I find useful topics.
    I want to make you a SAS/EG performance question:

    I have started to work with SAS/EG a few ago, I have worked a lot with SAS/BASE, but not SAS/EG.
    I have a doubt about SAS/EG. I know the main features of the tool, but I don’t know how it works with high volume of data and a lot of number of projects.

    I am starting a project with SAS/EG 4.3. We have to migrate JCL-Cobol process to SAS/EG. The process are typical process of reading files, sorting data, merging data, filtering data, aggregating data…, typical ETL steps. The process are typical process yo can do with SAS/EG.
    The problem is the volume. The volume of process and the volume of data used in the process.

    We have to migrate 500 processes. There are process that move files of 100 Gb.

    If I make 500 .egp projects in guide, ¿can we have them in a unique metadata or server?, ¿do I have to share out between several servers/metadata?. ¿How many projects can manage a metadata with good performance?.

    If you have to work with 100Gb files, would you use SAS/BASE or SAS/EG. I know, that I can modify code in my SAS/BASE programs to have a better performance, shorter processing times (objects like indexes, data in memory, etc..), but in SAS/EG I think I can modify less things….am I wrong?

    Other question:
    I will make the project in a windows server but I want to deploy it in a Unix server, the process will be scheduled in a Unix server and will be called from a .sh Unix shell script. Is it possible?, I think so…., but I prefer to make the question.
    As you can see my english is not profiency. I hope my questions are clear…
    Any advice will be greatly appreciated.
    Thanks in advance

    • Chris Hemedinger Chris Hemedinger
      Posted February 23, 2012 at 12:49 pm | Permalink

      Juan: hola y mucho gusto.

      Your questions are good and valid. I cannot provide a specific recommendation for your scenario, but I hope to provide a little bit of information to help.

      EG does not read all data into the client session, so the fact that you are using EG to access large data should not be a problem. EG accesses the column metadata (variable names, types, and formats) and only the amount of records needed to display a screen's worth of data. (However, very wide data with thousands of columns can be slower, so beware of that.)

      It's true that you have less control over the process when you use EG's tasks to represent your work. EG generates syntax that is designed to work well with databases or SAS data sets, but for the best optimization you might still want to maintain the work in SAS programs. If you have SAS programming expertise, this will probably be how you are most productive.

      You can still drive those programs within EG projects. Use EG to organize the programs into logical flows, so it's easy to understand how the process fits together. You can maintain the programs in files on your Unix OS, as long as EG can connect to a SAS session on UNIX.

      This allows you to use EG for editing and testing your programs, but use your UNIX OS for scheduling via cron or whatever your preference is. You can also use EG automation for scheduling, but that must be driven via a Windows process, as EG is a Windows-based application.

  4. juanvg1972
    Posted February 24, 2012 at 4:38 am | Permalink

    Hi Chris, thank you very much for your help. As you can see you have followers in Spain…
    I have more questions...

    Deployment in Unix:
    You design a .egp project in SAS/EG environment -> generate SAS code -> transfer the .sas to the Unix server -> run this .sas from a .sh shell script. (scheduled ).
    Is this the best way to operate if you have to execute in Unix?
    If I have understood you well, you can only scheduled process from the SAS/EG environment in Windows, am I wrong??

    Metadata management:
    Have you worked with a large amount of .egp projects in the same metadata/server?.
    We are going to build a large amount of projects.., at least 500..., and can be 20 users al the same time accesing...
    what do you recomend??.

    Your help is greatly appreciated.

    Have a nice weekend!!

    set nice.weekend;

    • Chris Hemedinger Chris Hemedinger
      Posted February 24, 2012 at 10:14 am | Permalink


      Yes, if you want a UNIX based scheduling process, then you will have to either:
      - maintain the SAS programs in the UNIX file system (but you can still use EG to develop and test), or
      - have the SAS programs in EG projects, and extract the programs before placing them in a production scheduled job on UNIX.

      As far as maintaining hundreds of EG projects - yes, that's possible. You can use either SAS metadata folders or UNIX file system folders. SAS metadata folders provide a logical folder structure and metadata permissions, BUT they do not provide an easy way to access the project files outside of SAS tools. UNIX file system folders are flexible in that regard, and you can rely on UNIX permissions to help manage access. And if you need to move the EGP files or reorganize, you can do so easily. So, given the little I know about your scenario, I think you would be happier if you kept the EGP files in the file system and not in metadata.

      Simultaneous access to the system by multiple users is no problem, but only one user can have a project file open for EDIT at a time. Multiple users cannot *change and save* a project file simultaneously, but multiple users may *run* the same project file.

      Enjoy your weekend!

      • juanvg1972
        Posted February 28, 2012 at 10:02 am | Permalink

        Hi Chris,

        I have another question:

        Can I have the SAS/EG metadata in a Unix server??

        I would like to work from win clients that connect to a SAS Server in Unix, that SAS Server content the metadata (projects definitions, libraries, etc..).

        Thanks in advance

        • Chris Hemedinger Chris Hemedinger
          Posted February 28, 2012 at 10:05 am | Permalink


          Yes, SAS Enterprise Guide can connect to SAS metadata servers on UNIX, Windows, and z/OS (mainframe). And SAS workspace servers can be on the same. So the only tier where you must use Windows is on the desktop where your end users run SAS Enterprise Guide.

  5. Juuan
    Posted February 28, 2012 at 5:47 pm | Permalink

    Thank you very much for your help Chris.

    More questions....

    We have some JCL jobs in maniframe that we want to migrate to SAS/EG process.

    That mainframe job has about 20 JCL steps by average. This steps are read files, data sorts, data filtera, merge of files, agregations process,and some calls to Cobol programs with no-complex business logic.

    Thi jobs move files of 100Gb. aprox and are scheduled in a Control-M. The performance is good.

    The idea si create a .egp SAS/EG project with all that steps. Ths simple steps like sorts, reads, merges we are going to make with SAS/EG components and the Cobol programs will be translated to SAS/BASE.

    We will generate the SAS/BASE code of the .egp projects, move tha .sas file to Unix and call it by a .sh shell script or schedule in Unix Control-M. The Unix server will be a good machine, with necessaty resources.

    My doubts are ¿is SAS/EG a suitable tool to replace maninframe JOBS?, ¿its has any limitationes with his components?. For example, the read component of SAS/EG has few optiones compared with an input read step os SAS/DI.

    ¿Can we have performance problems?. ¿are Unix systems and SAS process as solid and robust like mainframe environment process?

    Any advice will be greatly aprecciatted.

    Thanks in advance. Chris..

    • Chris Hemedinger Chris Hemedinger
      Posted February 29, 2012 at 9:55 am | Permalink


      I know that many SAS customers have done just what you are doing: migrated from mainframe COBOL-based jobs to SAS programs. That's a well-proven path.

      You can use EG to develop/test/run these SAS programs against your UNIX server. Other than the work of converting your programs, it should be a straightforward process.

      The area to be careful about is when you use point-and-click tasks in EG to replace some of the programs that you need, especially for work such as importing data. You *can* use EG to import text files, but the EG Import Data task brings some of that work into the client tier. Instead, to maintain a server-centric approach, you should use SAS programs to do that work.

      For answers on questions that are specific to your environment, I suggest that you work with SAS Technical Support or other SAS consultants from your local SAS office. I can provide only limited advice/guidelines in this blog forum, of course...

  6. Jim Baillie
    Posted March 2, 2012 at 9:52 am | Permalink


    We have an environment with 3 SAS Servers (Test, Dev & Prod). How do I register/set up these servers so EG can utilize these Base SAS 9.2 servers?

    Currently my EG session says: "No Metadata profile selected". How do you create profiles?

    • Chris Hemedinger Chris Hemedinger
      Posted March 2, 2012 at 12:09 pm | Permalink


      A metadata profile allows you to connect EG to a SAS metadata server and SAS workspace server. These are made possible by setting up SAS Integration Technologies (which you might have on its own or as part of a larger solution, such as SAS BI Server).

      To create a new profile, click on the "No profile selected" link in the EG status bar. That brings up the Connections window. You then click Add, which brings you to Create Profile. You'll need the host name of the metadata server, the port that it's listening on, and user credentials to connect. If you have a true dev/test/prod environment, you'll have a different metadata server instance for each environment (though they can all be on the same host, with different ports).

  7. juanvg1972
    Posted March 6, 2012 at 1:42 pm | Permalink

    Hi Chris,

    Thank you very much for your help and answers...

    A new question for you:

    I know that SAS/EG has a job scheduler in windows, but I don't know if it's possible to schedule a job
    in Unix using SAS/EG, is that possible??


    • Chris Hemedinger Chris Hemedinger
      Posted March 6, 2012 at 1:47 pm | Permalink

      Juan, no, there isn't a UI method in EG that can interface with a UNIX scheduler. You can schedule an EG project using the Windows scheduler, and that project can have content that *runs* on UNIX, but it still requires the Windows client in the mix.

  8. K Shah
    Posted December 12, 2012 at 10:17 am | Permalink


    tried running the code but got an error saying

    SAS.EG.SDS.Metadata.MetadataException: Request for login credentials canceled by user
    at SAS.EG.SDS.Metadata.OMSProvider.Connect()
    at SAS.EG.ProjectElements.MetadataHelper.ConnectToProvider()
    at SAS.EG.Scripting.Application..ctor(String_cmdLineProvider)

    Any ideas?

    • Chris Hemedinger Chris Hemedinger
      Posted December 12, 2012 at 10:20 am | Permalink

      That sounds familiar. Check to make sure that you have the latest hotfixes for EG (4.3 or 5.1), as I believe a similar issue was addressed after the initial software shipment.

  9. Prashant
    Posted February 13, 2013 at 3:27 pm | Permalink

    Hi Chris,
    This may be a Silly Question .Can a user (once set up in the Metadata Repository via SMC) connect to only the Metadata Server via SAS EG? In other words if he does not have access to SAS Application Server administered by the Metadata server, can he just connect to the Metadata server via SAS EG. I understand that in doing so he cannot run any SAS Programs as the SAS App Server is not available.But is this possible at all via SAS EG? One of my colleague tried to login to SAS EG to metadata server even though he did not have access to the SAS Application server managed by the Metadata server and he was unable to do this. Why is this so?

    • Chris Hemedinger Chris Hemedinger
      Posted February 13, 2013 at 3:31 pm | Permalink

      Prashant, not a silly question at all!

      You should be able to use EG to connect to a metadata server, even if you don't have an available SAS Workspace (application) server. You won't be able to open data or run programs, but you can view the content of SAS Folders.

  10. Prashant
    Posted February 16, 2013 at 5:26 pm | Permalink

    Hi Chris,
    Thanks for your answer to my question above. Now my only question is if SAS EG can connect to only the Metadata Server if needed, then how is this achieved?Basically when I launch the SAS EG application on my Windows machine at my Work , it first launches the Metadata Profile window called "Credentials Required" in which i enter my Userid and Password.And then it connects to the Metadata Repository ( say for eg TAASASF1) and at the same time it also connects me to the SAS Workspace (Application server) with the same name ie TAASASF1. But if in the Metadata Profile Window i enter the userid and Password of a person who has access to ONLY the Metadata Server (TAASASF1) but not the SAS Workspace server (TAASASF1) , then it does not allow him to login into the metadata Server. In this case the Metadata Profile window keeps prompting for the Userid and password again and again. So what is going on here? Is there any tweaking which is required for this person to login to just the Metadata Server (TAASASF1) or is it that my SAS Admin has setup the Metadata Profile in a way that does not permit login to just the Metadata Server (TAASASF1) ? Hope i am making sense.

    • Prashant
      Posted February 17, 2013 at 3:37 am | Permalink

      Also Chris, the reason i say that this particular user has access to the Metadata Server (TAASASF1) is becuase he can access both the SAS Information Delivery Portal and SAS Web Report Studio associated with the Medata Server(TAASASF1) and he can run Reports registered with this Metadata Server. As such i am assuming he is defined as a User in the Metadata Repository.But this same user cannot connect to this Metadata Server via SAS EG. Am i missing something here in terms of the concepts of Metadata Server and SAS Application Server?

      • Chris Hemedinger Chris Hemedinger
        Posted February 19, 2013 at 5:40 pm | Permalink

        To be able to connect to the SAS Workspace Server from EG, you need the "Log on as a batch job" privilege (assuming a Windows server) -- that is, your user login must be associated with a machine account that can connect. That requirement is not the same for ID Portal and SAS Web Report Studio users.

        However, I don't know why EG is making a connection to the Workspace server automatically. It should connect only to the Metadata server unless you try to open a data set, run a task, or run a program. You might need to work with SAS Technical Support to resolve this question. They might ask you to supply some logging information that the metadata server and object spawner will produce.

  11. Sandra
    Posted May 6, 2013 at 8:21 am | Permalink

    Thanks for the SAS dummy blog...I have a problem in using my local profile. Whenever I try to connect to local it give me error saying that A connection could not be made to the SAS Metadata Server. Connection failed
    Could not establish a connection to the SAS server on the requested machine. Verify that the SAS server has been started with the -objectserver option or that the SAS spawner has been started. Verify that the port Combridge is attempting to connect to is the same as the port SAS (or the spawner) is listening on.

    I did also try to connect No profile Mode but I can't make any connection. Can you please help me with this??I am kinda really frustrated now. What is the requirement of program to run local profile and no profile mode??? I have Enterprise guide 5.1 and expired in july 2013. Thank you very much.

    • Chris Hemedinger Chris Hemedinger
      Posted May 6, 2013 at 9:03 am | Permalink

      Sandra, in order to run in "No Profile" mode you must have SAS installed on your local PC -- on the same machine with SAS Enterprise Guide. If you check Help->About SAS Enterprise Guide and click Configuration Details, you'll see whether SAS Enterprise Guide has detected a local SAS installation. If you have SAS installed on this machine but it's not showing up, you might need to run "sas /regserver" as described in this SAS Note. If the problem continues, I suggest that you contact SAS Technical Support.

  12. Tebogo
    Posted May 22, 2013 at 11:41 am | Permalink

    I'm running in no profile m on my loacl pC suing EGuide 5.1 and SAS 9.3. I trying to create a stored process but I get this error: "SDS Failed to provide the user context. Active OMSProvider is required". Any ideas?

    • Chris Hemedinger Chris Hemedinger
      Posted May 22, 2013 at 3:02 pm | Permalink


      You can create stored processes only if you are connected to a SAS Metadata environment -- "No Profile" mode won't work for that. If you have just local SAS and no SAS Metadata Server, you won't be able to use SAS Stored Processes.

  13. Igor
    Posted February 3, 2014 at 11:26 am | Permalink

    Hi Chris, thanks for the blog article.
    I have a question similar to Sandra's one. I get the same error message also I checked for the installed SAS via the way you suggested (check Help->About SAS Enterprise Guide and click Configuration Details).

    Problem report created: Monday, February 03, 2014 3:23:06 PM UTC

    An unexpected error has occurred while accessing metadata
    A connection could not be made to the SAS Metadata Server but is required for the current operation. Please see your administrator.
    Connection failed
    Could not establish a connection to the SAS server on the requested machine.  Verify that the SAS server has been started with the -objectserver option or that the SAS spawner has been started.  Verify that the port Combridge is attempting to connect to is the same as the port SAS (or the spawner) is listening on.
    --- SAS Software ---
      SAS Enterprise Guide version:
      SAS System version: 9302.0.20524.8057
      SAS System Command: c:\progra~1\sashome\sasfou~1\9.3\sas.exe -config "c:\program files\sashome\sasfoundation\9.3\sasv9.cfg"  -objectserver -nologo -noterminal -noprngetlist

    It is there since I have a SAS System version along with SAS EG version.
    The problem that I cannot create a stored process because this option is inactive when I click on any SAS program in my project. Could you please help me with that?

    • Chris Hemedinger Chris Hemedinger
      Posted February 3, 2014 at 1:03 pm | Permalink


      In order to create a stored process, you must connect to a SAS metadata environment. The SAS Metadata Server is a separate process that runs (usually) on a central server for multiple SAS users to connect to. You can read about this and more in the SAS 9.3 Intelligence Platform: Administration Guide.

      If you work in an environment where you have centralized SAS environment, your SAS administrator can tell you the host/port and credentials to use to connect to it. If you simply have a SAS install on your local PC along with SAS Enterprise Guide, you typically would not have a SAS Metadata Server. It's possible to set one up, but you still need SAS Integration Technologies (a separately licensed product from SAS) to create/run SAS Stored Processes.

  14. Grace
    Posted May 29, 2014 at 9:42 pm | Permalink

    I have similar issues and tried many times. The problem has not been solved.

    after I installed SAS enterprise 4.3, " A local SAS server was not found, and no metadata profile is being used. Without a SAS server you cannot open data or run SAS programs. Do you want to create or modify your profile information?"

    I click "Yes", a default with gray "set Active". I don't know how to set up from here?

    I tried to add few profiles, they are not working.
    for example, I added a profile and click "set Active", a popup error message shows " A connection could not be made to the SAS Metadata Server but is required for the current operation. Please see your administrator".
    what can I do next? please help.

    • Chris Hemedinger Chris Hemedinger
      Posted May 30, 2014 at 9:21 am | Permalink

      Grace, to use EG you either need a local SAS install (sounds like you don't have one), or access to an administered SAS environment. A SAS administrator -- the person/group who supports your SAS environment -- would need to provide you with the details that you need for your SAS profile.

      Are you a student who needs to learn SAS? You might look at the SAS University Edition, which is free and includes a SAS environment and the SAS Studio application for end users.

  15. Kiran
    Posted June 23, 2014 at 3:28 am | Permalink

    Hi Chris,

    I have EG connected with metadata server with 2 grid nodes. I want to send two individual subtasks(2 PROC sort programs) to individual grid nodes(Grid node 1 and Grid node 2) and merge those subtasks in any one of the grid node with manual program with conditionally after completeion of two subtasks. So, in this scenarion how can i write the program? How to find the grid nodes and represent in the program with maually/conditionally?
    Currently when i analyze the normal SAS Program with Analyze the Program with Grid Computing , it is generate the code with session wise not like Grid node wise?
    Please clarify. Thanks

    • Chris Hemedinger Chris Hemedinger
      Posted June 23, 2014 at 8:33 am | Permalink

      The "Analyze for Grid Computing" feature should recognize the parts of your program that can run in parallel, and then trigger those parts in separate SCAPROC macros (that wrap the rsubmit sections for running the different program tasks). You can see more about this approach in the Grid Computing in SAS documentation.

  16. Edward Jin
    Posted April 15, 2015 at 4:25 am | Permalink

    Hi, Chris.
    It's an enlightening blog.

    I have a silly question.
    Currently, I'm using EG 6.1 to connect to SAS Metadata 9.4.
    And, I constantly receives a dialog "Credentials Required" to input username and password. when I try to expand "SASApp".
    Do you have any idea about it?

    Many thanks in advance.


    • Chris Hemedinger Chris Hemedinger
      Posted April 15, 2015 at 8:54 am | Permalink


      If the credentials (user/password) you use for SAS metadata are different than those you use for the SASApp server, then you could see a prompt for credentials. There are various methods to work around this: create an authdomain for the SASApp server and record your credentials in there, cache your credentials locally (if permitted). These methods rely on your SAS administrator to set policies and privileges that allow these techniques. I recommend that you check with your SAS admin (hope you know who that is!) to see what can be done.

Post a Comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">