Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

Share this Page URL
Help

Chapter 4. Modifying Data Using the Quer... > 4.9 Recoding Values in a Query - Pg. 218

218 The Little SAS Book for Enterprise Guide 4.2 4.9 Recoding Values in a Query If you want to group data together based on a set of values in a column, you can do this by recoding a column in the Query Builder. For example, if you have sales offices from several different cities, you may want to group them by region. If region is not already defined in the data, then you can define it using the Query Builder. Recoding a column is similar to creating and applying user-defined formats to a column. But, when you recode a column, you create a newly computed column where the data values are actually changed. When you use formats, only the way the data values are displayed is changed. Here are a few rows from the Latlong data table, which gives the latitude and longitude of volcanoes from around the world. Using the recode feature of the Query Builder you can group the volcanoes by zone, according to the value of the column Latitude. To open the Query Builder, click the data icon in the Project Tree or Process Flow to make it active, and select Tasks Data Query Builder from the menu bar. This opens the Query Builder window with the Select Data tab on top. Select the columns for the query. In this case, all the columns in the table are selected. Chapter 4 Creating the recoded column In the Query Builder window, right-click the column to recode (Latitude for this example) in the list of columns on the left and select Recode Column. This opens the New Computed Column wizard.