Every time you run a task that produces a report, SAS Enterprise Guide decides how the data should be displayed. That’s good, but sometimes the way that SAS Enterprise Guide displays data may not be exactly what you want. You can apply a format in a Data Grid, but then the format will be saved with the data table. To avoid that, you can apply the format directly in a task.
Here is the Eruptions data set displayed in a Data Grid. This example uses the List Data task to show how you can apply the format WEEKDATEw.d to the variable StartDate in a task.
In the Project Explorer or Project Designer, click the data set icon to make it active. Then select
Describe ► List Datafrom the menu bar. The List Data window will open, displaying the Task Roles page.
Opening the Properties Window
To open a Properties window for a variable, right-click the name of the variable you want to modify (in either the Variables to assign area or the Task roles area), and select Properties from the pop-up menu. In this example, the variables Volcano, StartDate, and VEI have been assigned to the List variables role, and Properties is being selected for StartDate.
Here is the Properties window for the variable StartDate. You cannot change a variable from numeric to character (or vice versa) using the Properties window inside a task. To make that change, use the Properties window inside a Data Grid.
Click Change to open the Formats window.
Selecting formats
In the Formats window, choose the category of formats you want to see, and then click the name of the format you want to use. In the area labeled Attributes, specify the overall width (the longest number of characters that will be allowed for this variable), and, for numeric variables, the number of decimal places. The area labeled Example shows a sample of how this format will look.
In this Formats window, the category Date has been selected, along with the format WEEKDATEw.d, an overall width of 17, and no decimal places. This format can be written as WEEKDATE17.0.
When you are satisfied with the format, click OK. Then click OK in the Properties window, and click Run in the task window.
Results
Here is the beginning of the report using the new format for StartDate. Any formats you apply in a task are not saved in the original data set and will not be used in other tasks.
About the Authors
In 1992, Susan Slaughter and Lora Delwiche teamed up to write The Little SAS Book: A Primer, now in its third edition, which quickly became a popular item on SAS users' bookshelves. They have presented numerous papers at local, regional, and international SAS users group meetings. Their interactions with other SAS users have inspired them to write books that are both informative and enjoyable to use. Susan currently works as a consultant through her company, Avocet Solutions, while Lora works in research at the University of California, Davis.
Their books are available from the online bookstore.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
Type: | Sample |
Topic: | Non SAS Authors ==> Lora Delwiche Non SAS Authors ==> Susan Slaughter Internal Administration ==> BBU |
Date Modified: | 2006-11-08 03:02:59 |
Date Created: | 2006-11-08 03:02:59 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | SAS Enterprise Guide | All | 9 TS M0 | 9.1 TS1M3 |
SAS System | Base SAS | All | 9 TS M0 | 9.1 TS1M3 |