Write and run SAS programs in your web browser

Task that allows user to select from values of variable in a dataset.

Reply
Super User
Super User
Posts: 7,076

Task that allows user to select from values of variable in a dataset.

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?

SAS Employee
Posts: 8

Re: Task that allows user to select from values of variable in a dataset.

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

 

 

Ask a Question
Discussion stats
  • 1 reply
  • 247 views
  • 0 likes
  • 2 in conversation