Desktop productivity for business analysts and programmers

Transferring syntax to SAS EG and integrating prompts

Reply
New Contributor
Posts: 3

Transferring syntax to SAS EG and integrating prompts

Hello all,

So, I know now how to create prompts and use those prompts (which create macro variables) when using standard SAS EG tasks (except filtering - can't seem to use them then?).

Now, I'm looking for some guidance on whether there is a way to write my own program in SAS EG and then put the prompts in there.


My macros were written in Base SAS and it would take me forever to re-do them from scratch in SAS EG. Can I simply cut and paste from Base SAS into a new SAS EG project and somehow integrate the prompts with my macro variables?

So far I've created a new program in SAS and written some basic syntax to create a data set in the work library, then then created some prompts in the prompt manager using the new data set. After that I then tried adding some code to the program to create a new table using only the gender variable. I referenced the macro variable (prompt) i created earlier, however, I get an error message saying it cannot resolve the reference.

I do not have access to stored processes.

Thanks so much for your time,

A

Community Manager
Posts: 2,712

Re: Transferring syntax to SAS EG and integrating prompts

A,

You have a couple of options.  For the ultimate control over the user interface, you can create a custom task.  This process involves programming in Microsoft .NET, but the mechanism might be easier than you think.

Custom task reference (with links to information about my book on the topic):

  http://go.sas.com/customtasksapi

Here's an example task that is a front-end for a simple macro:

  Putting the squeeze on your SAS data sets - The SAS Dummy

If you are looking to create a standalone-application (where the user doesn't even see the SAS EG interface), you can use SAS Enterprise Guide automation.  That API and examples are linked from here:

Doing more with SAS Enterprise Guide automation - The SAS Dummy

Finally, if you're looking to use prompts within filters, check out the %_eg_where_param macro.  That's the construct that you need to create effective filters that use SAS Enterprise Guide prompts.  See Angela's guidance on this here:

SAS Enterprise Guide Prompting Examples using %_eg_WhereParam

Chris

SAS Employee
Posts: 3

Re: Transferring syntax to SAS EG and integrating prompts

Hi A,

In our SAS Enterprise Guide classes we teach you how to integrate prompts into queries, tasks, and code.  If you don't get a chance to take our classes, one of our previous instructors Kenny Sucher wrote a great paper that I think will show you exactly what you want to do.  Check out Interactive and Efficient Macro Programming with Prompts in SAS® Enterprise Guide® 4.2.  The section that you will interest you most is on ADDING RUN-TIME PROMPTS TO CODE.  You will discover that the reason your prompts are not resolving is because they need to be added to the properties of the program.  Hopefully between this paper or one of Chris' suggestions, you can get your prompts working.

Andy

Ask a Question
Discussion stats
  • 2 replies
  • 403 views
  • 0 likes
  • 3 in conversation