Desktop productivity for business analysts and programmers

Two questions involving prompts in Enterprise Guide

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 9
Accepted Solution

Two questions involving prompts in Enterprise Guide

I have looked through quite a few of the previous posted discussions on prompts and haven't found any answers to two questions I have.

1. Here is the scenario. In a project built using SAS EG 5.1, I take an original data set and use a Query Builder to filter on certain fields (columns) and do various other things. In that Query Builder, I set up some prompts for the aforementioned filters. Say, for example, that there is a field called 'Numbers' containing integers 1 through 10 and the prompt is named "Selected_Numbers". I want to use the value contained in the prompt "Selected_Numbers" later in the project in a SAS Program. I have selected the "Use prompt value throughout project" box and the prompt functions correctly in the Query Builder. What do I need to do to be able to access the value stored in "Selected_Numbers"?

2. I have a program (not the one mentioned in #1 but also in EG 5.1) for which a prompt is necessary. I have added the prompt by right clicking on the program, going to properties and adding the prompt under the "Prompts" section found in the left pane. What do I need to do to access this prompts value in the program?

I have been using EG for about a week and a half now and this is my first post under SAS' discussion board, so if I have posted this in the wrong place or have said/done something incorrect, please let me know.

Thank you in advance for your insights,

audioa84


Accepted Solutions
Solution
‎03-18-2013 09:45 AM
Community Manager
Posts: 2,697

Re: Two questions involving prompts in Enterprise Guide

To access the value in a SAS program:

- in the program Properties window, select the Prompts tab and add the prompt you want to associate with the program.  You'll be able to select a prompt that you have already defined for use in the query builder.

- in your program, use the SAS macro variable that is created by the Prompt definition.  Usually this is just the name of the prompt (ex: &number), but for certain prompt types the macro variable might not be so obvious.  You can use the Macro Viewer custom task as an easy method to find out which macro variables are created by the Query Builder prompt.

You might also find this post from Angela to be useful.

Chris

View solution in original post


All Replies
Grand Advisor
Posts: 17,383

Re: Two questions involving prompts in Enterprise Guide

Depends on how you want to use it. In query builder, another task or in code?

Here's a paper that explains how to build reports using prompts.

http://www.lexjansen.com/wuss/2010/tut/3049_4_tut-leslie.pdf

Occasional Contributor
Posts: 9

Re: Two questions involving prompts in Enterprise Guide

When I use the name "SAS Program", I mean base SAS code contained in a SAS Program (try right clicking the background in a project flow, click new and select program. Unfortunately, the portion of the paper you linked to only covers the basics of adding a prompt to a Query Builder.

Solution
‎03-18-2013 09:45 AM
Community Manager
Posts: 2,697

Re: Two questions involving prompts in Enterprise Guide

To access the value in a SAS program:

- in the program Properties window, select the Prompts tab and add the prompt you want to associate with the program.  You'll be able to select a prompt that you have already defined for use in the query builder.

- in your program, use the SAS macro variable that is created by the Prompt definition.  Usually this is just the name of the prompt (ex: &number), but for certain prompt types the macro variable might not be so obvious.  You can use the Macro Viewer custom task as an easy method to find out which macro variables are created by the Query Builder prompt.

You might also find this post from Angela to be useful.

Chris

Occasional Contributor
Posts: 9

Re: Two questions involving prompts in Enterprise Guide

Thanks for the response. For some reason when I tried just using &number prior to posting my questions, it wasn't working. However, after trying it again after reading your response, its working fine. Thanks for the info.

Mark

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 1153 views
  • 0 likes
  • 3 in conversation