BookmarkSubscribeRSS Feed
awmk
Calcite | Level 5

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

2 REPLIES 2
ChrisHemedinger
Community Manager

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

Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.
AndyRav
SAS Employee

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

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1441 views
  • 0 likes
  • 3 in conversation