BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
audioa84
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

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

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

View solution in original post

4 REPLIES 4
Reeza
Super User

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

audioa84
Calcite | Level 5

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.

ChrisHemedinger
Community Manager

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

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
audioa84
Calcite | Level 5

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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