Your SAS programs, embedded in web apps and elsewhere

How to run a SP in EG and get the output displayed

Posts: 0

How to run a SP in EG and get the output displayed

Hi all,
I'm new at stored procedures and still pretty new with Enterprise Guide.
I'm want to convert a program that does a bunch of things and finishes with a proc print. So far, everything works great except that I don't have the html output displayed when executed as a stored procedure in EG.
Is there a special ODS statement that I should use or a setting in EG to modify?
Thanks in advance.
Posts: 8,863

Re: How to run a SP in EG and get the output displayed

Posted in reply to deleted_user
SAS and the Enterprise Intelligence Platform do not have "stored procedures" in the same way that some data base systems like Oracle or DB2 have stored procedures -- SAS has "stored processes".

A stored process (SP) is a SAS program that's been especially defined to live in a stored process repository and has metadata descriptions of which server should run the stored process, what the output types are, etc. Generally, a SAS stored process runs from within client applications that are part of the SAS Enterprise Intelligence Platform.

Before you can RUN a stored process in SAS Enterprise Guide (or any other client application), you have to DEFINE and REGISTER your stored process in the metadata repository. (And your security person has to give you various permissions to the data and to the repository where you're going to write your stored process code, etc etc)

There are 2 ways to define and register your stored process in the metadata:
-- using SAS Management Console (in this case, you do have to make sure ALL your code has been coverted to be the way SAS expects a stored process to look) and then you have to manually register the SP using the SAS Management Console or
-- using the EG Stored Process Wizard to convert your code, define the stored process metadata AND register the stored process.

Of the two methods, the EG Stored Process Wizard is the best approach if you are new to SAS, and new to EG.

You can generate a SAS Stored Process from code in an EG code node; from code that's generated by an EG task or wizard; or from code that you import into an EG code node; you can create a stored process from one task in a project or from an entire have lots of different options here...too many to list.

How you are going to create your SP (stored process) depends on whether you're starting with a bunch of tasks in a project or code that you have in a code node. EG has a Stored Process Wizard that steps you through the 7 or 8 steps that are involved in turning your project code, or 1 task's code, or your code node into a Stored Process.

The bottom line is that do not need to add any ODS statements to your code. EG's Stored Process Wizard does that for you. Basically, there are some special macro calls that the wizard puts "around" all your code and then assuming that you pick a result type of "Streaming" you should see the results of running the stored process.

The easiest thing to do is to start small.
--make a simple project -- open one (small-ish) data file
--do a LIST DATA task on the file
--once you see results from the LIST DATA task, go back and right mouse click
on the task icon and select "Create a Stored Process"
-- walk through all the steps and take all the defaults for registering the stored process in the metadata
--make sure that you select 'streaming' as the result type
-- you will have a choice on one of the last dialog boxes whether to RUN when finished. Go ahead and click that box (in the lower left).

Assuming that you have a repository that you're allowed to write the SP to and that you have the right permissions on the file access, you should see results from running the SP and they should be the same as when you ran the List data task.

If you right-mouse click in the Project designer area, you also have the choice to create a stored process from an entire project. From the File Menu,
you can select New --> Stored Process if you want to start from code that you already have. EG will add the appropriate "wrapper" code for you when it builds the stored process. In fact, if you're importing code into EG, it's probably better for you NOT to have any ODS wrapper code in your program (unless you want to manually convert the program).

If you want to manually convert your program to be a SAS Stored Process, then my SGF paper on "Adapting Your Programs to the SAS 9 Paradigm" goes through the steps for converting legacy code (manually) to become stored processes. You can find that paper here:

Otherwise, your best bet for help with EG is probably to contact Tech Support and let them know exactly what you want to start from (code node, task, project, etc) to build a stored process and they can help you. The "click path" is quite lengthy and you may run into authorization and permission issues along the way that will be bumps in the road. The other thing you could do is see whether anyone at your company has taken the SAS training for the Stored Process course. If so, Chapter 5 in that course covers ALL the ways to use EG to build stored processes.

Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation