BookmarkSubscribeRSS Feed
Tom
Super User Tom
Super User

I was trying to build a Task using SAS/Studio that allows a user to make a select from a list of values pulled from a variable in a SAS table.  The SAMPLE task has a DISTINCT option that works that way, but it is setup for the user to first select the dataset and the variable.  For this application I want to just hard code the dataset and varaible name into the task definition. Only user input will be to pick a value from the list.

 

So in the Sample Task they have defined this distinctEXAMPLE option that references the option named VAR.

<Option name="distinctEXAMPLE" inputType="distinct" source="VAR">Distinct Values:</Option>

And the VAR option is defined earlier in the Data Sources section as:

<DataSources>
  <DataSource name="DATASOURCE">
    <Roles>
      <Role type="A" maxVars="1" order="true" minVars="1" name="VAR">Required variable:</Role>
      <Role type="N" maxVars="0" order="true" minVars="0" name="OPTNVAR" exclude="VAR">Numeric variable:</Role>
      <Role type="C" maxVars="3" order="true" minVars="0" name="OPTCVAR">Character variable:</Role>
    </Roles>
  </DataSource>
</DataSources>

So how would I modify this so that "distinctEXAMPLE" will get the list of disctinct values of the variable named "DATABASE" in the dataset named  "MYMETA.SOURCEDB" without the user needing to first select that dataset and variable name?

1 REPLY 1
grace_sas
SAS Employee

Hi Tom,

 

You cannot currently hardcode a datasource and role in the metadata or UI elements.  So there is no way to reference the variable to use a distinct control (or any other control).  This ability is being evaluated for a future release.

 

Best,

Grace

 

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Develop Code with SAS Studio

Get started using SAS Studio to write, run and debug your SAS programs.

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
  • 1 reply
  • 1164 views
  • 0 likes
  • 2 in conversation