From the course: SAS® 9.4 Cert Prep: Part 07 Using SQL in SAS

Unlock this course with a free trial

Join today to access over 22,500 courses taught by industry experts.

Filtering and sorting output

Filtering and sorting output

- [Instructor] So, what if you don't really want all of the rows in the table? Suppose you want to include only students who are more than 14 years old. To tell SQL how to choose only the rows you want, you can use the same where syntax that worked in other SSAS procedures, and the data step. However, the where expression is not a separate statement in SQL. Instead, it's a clause added to the select statement. Only those rows from the input table that meet the criterion provided are included in the report. In a traditional SSAS program, if you want a report produced in a particular order, you must a proc sort step to sort the data, and then run a reporting procedure using the sorted data. However, in SQL you can do it all in one query. To do this, you add an order by clause to describe the order in which you want the results arranged. If you want the rows ordered with the tallest person listed first, descending order, you…

Contents