Desktop productivity for business analysts and programmers

Computed Column using Parameter

Reply
Occasional Contributor acw
Occasional Contributor
Posts: 9

Computed Column using Parameter

Hi

How can I make a computed column use the result of a parameter in an eguide Filter and Query.

Say I have a parameter called thing.

How do I structure the expression text so that it can use the parameter. I've tried &thing, "&thing" and various other combinations, but I can't get it to request the parameter to fill before actioning. Error along the lines of symbolic reference not resolved.

Peversely system parameters seem to resolve properly. So an Expression Text of "&_clientuserid" will resolve to the user id.

thanks
acw
Contributor
Posts: 30

Re: Computed Column using Parameter

The parameter has to be given a value before you can use it.

You can use the parameter manager, (under the tools menu), and to create it. There are options as to how it gets a value, by prompting, etc. Then right click on the filter query task select properties / parameters and add the parameter to the query. It should then get resolved.

Search the EG help for creating parameters or even this forum
Occasional Contributor acw
Occasional Contributor
Posts: 9

Re: Computed Column using Parameter

Derek

thanks, but 'fraid that just doesn't work.

I create the parameter, name: thing, type: string, default value: aaa, prompt for value selected, allow macro substitution selected, (even tried enclose values within quotes).

Then created a filter and query, with expression text of &thing, and left it with the default name of Calculation1.

The moment I close down the construction of the calculated item, it causes the error. Log is:

WARNING: Apparent symbolic reference THING not resolved.
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant,
a missing value, BTRIM, INPUT, LOWER, PUT, SUBSTRING, UPPER, USER.


However, if I use the system item &_clientuserid, I can get it to populate properly by putting "&_clientuserid" into the text of the computed column. If I use "&thing", it will run, but returns &thing rather than resolving for parameter input.

acw
Contributor
Posts: 30

Re: Computed Column using Parameter

It will do. You have to pass a value to the parameter for it to work. If you use the parameter manager you can specify a default value or ask it to prompt you.

Have a look at the help, it covers how to do this
SAS Employee
Posts: 149

Re: Computed Column using Parameter

ACW: Did you register the parameter with the Filter and Query task? Right-click the task, select properties, and the third choice down in the selection pane should be called "prompt" (EG 4.2) or "parameter" (EG 4.1). You need to add the parameter to the task in order for things to work. Sneaky, isn't it? In EG 4.2, you can also add a prompt directly in the Query Builder interface under Options \ Options for this query.

This is also a handy tactic when you have prompts in a piece of SAS code.
Occasional Contributor acw
Occasional Contributor
Posts: 9

Re: Computed Column using Parameter

RichardH

Thank you, thank you, thank you. That was the missing trick.

Included the parameter in that way, and things resolved properly.

Also tried the code option. Hadn't even thought about doing that at this stage.

acw
Ask a Question
Discussion stats
  • 5 replies
  • 1566 views
  • 0 likes
  • 3 in conversation