SGDESIGN Procedure

Example 3: Using the DYNAMIC Statement to Specify a Column and a Character String

Features:

DYNAMIC statement

This example substitutes a column and also initializes the dynamic text for a title. The example assumes the following:
  • the existence of a shared-variable graph named svExample.sgd that uses the SASHELP.CLASSFIT data set. To create this SGD file, follow the steps provided in Example: Create a Shared-Variable Graph and Add a Dynamic Title in SAS ODS Graphics Designer: User's Guide.
  • in the SGD file, the shared variable V1 is set to WEIGHT.
  • in ODS Graphics Designer, the title of the graph is Distribution of dyn(EXAMPLESV).
Create the graph using the default data.You generate this graph only for comparison purposes.
proc sgdesign 1sgd="svExample.sgd";
  2dynamic EXAMPLESV="Class Weight"; 
run;
1 Specify the path and name that you used when you saved the SGD file. For example, the path might be "C:\SGDFiles\svExample.sgd."
2 Though this example uses the default value for the shared variable V1 (WEIGHT), there is no default value for the dyn(EXAMPLESV) function that is used in the title. To execute this SGD file with a correct title, the dynamic expression used in the title must be initialized, as shown in the code. In the output, the title becomes Distribution of Class Weight. The “Distribution of” portion of the title was defined in the SGD file. The “Class Weight” portion is generated dynamically.
Create the graph using different data.You can create the graph using a different data set and substitute a different column for V1. You can also change the dynamic variable that is used in the title. In the output, the title is Distribution of Cholesterol.
proc sgdesign 1sgd="svExample.sgd"
     data=sashelp.heart;
   dynamic 2V1="cholesterol" EXAMPLESV="Cholesterol"; 
run;
1 Specify the path and name that you used when you saved the SGD file.
2 The CHOLESTEROL column is the same type as the WEIGHT column that was defined in the SGD file. The columns can be different as long as they are the same type (numeric in this case).