DEFINE VALUESET |
The DEFINE command with the VALUESET keyword adds a new valueset object to an analytic workspace. A valueset contains a list of dimension values for a dimension. The values in a valueset can be saved across sessions.
When you first define a valueset, its value is null. You must specify values for a valueset using the LIMIT command. You can also use a STATUS statement and the STATFIRST, INSTAT, and VALUES functions to work with a valueset.
Syntax
DEFINE name VALUESET dimension [<dims...>] [TEMP] [AW workspace] [SESSION]
Arguments
The name of the object you are defining. For general information about this argument, see the main entry for the DEFINE command.
The object type when you are defining a valueset.
The name of the dimension whose values you want to store in the valueset.
The names of the dimensions, if any, of the valueset. You must define a dimension before you include it in the definition of a valueset.
Indicates that the valueset's values are only temporary. The valueset has a definition in the current workspace and can contain values during the current session. However, when you update and commit, only the definition of the valueset is saved. When you end the session or switch to another workspace, the values are discarded. Each time you start the workspace, the value of a temporary valueset is null.
The name of an attached workspace in which you wish to define the valueset. The valueset must be defined in the same workspace as its dimensions. For general information about this argument, see the main entry for the DEFINE command.
Specifies that the object exists only in the current session. When the session ends, the object no longer exists. This differs from the TEMP keyword, which specifies that the values are temporary but the object definition remains in the workspace in which you create it.
Examples
Creating and Assigning Values to a Valueset
This example adds the valueset named lineset to the demonstration workspace. The lineset valueset is dimensioned by line, and therefore it can be limited by the current values of the line dimension. The LD statement attaches a description to the object.
The following statements 1) limit the line dimension and display the values in status; then, 2) create a valueset named lineset , assign the values currently in status for the line dimension to the lineset, and display the values of the lineset.
LIMIT line TO FIRST 2 STATUS line
The current status of LINE is: REVENUE, COGS
DEFINE lineset VALUESET line LD Valueset for LINE dimension values LIMIT lineset TO line SHOW VALUES(lineset)
Revenue Cogs
Creating and Assigning Values to a Multidimensional Valueset
Assume that your analytic workspace has the variables and dimensions with the following definitions.
DEFINE geography DIMENSION TEXT DEFINE product DIMENSION TEXT DEFINE sales VARIABLE DECIMAL <geography product> DEFINE salestax VARIABLE DECIMAL <geography>
Assume also that the analytic workspace contains the following dimensions whose values are the names of variables and dimensions within the workspace.
DEFINE all_variables DIMENSION TEXT MAINTAIN all_variables ADD 'sales' 'salestax' DEFINE all_dims DIMENSION TEXTMAINTAIN all_dims ADD 'geography' 'product'
The following statement creates a valueset for the values of all_variables and all_dims.
DEFINE variables_dims VALUESET all_dims <all_variables>
REPORT values(variables_dims)
ALL_VARIABLES VALUES(VARIABLES_DIMS)
---------------- ------------------------------
sales geography
product
salestax geography
product
To create a multidimensional valueset that has the correct dimensions related to the variables that use them, you issue the following statement that uses a QDR to limit the all_dims values for the salestax value of all_variables.
LIMIT variables_dims(all_variables 'salestax') TO 'geography'REPORT values(variables_dims)ALL_VARIABLES VALUES(VARIABLES_DIMS)---------------- ------------------------------sales geography productsalestax geography