Eliminating Duplicate Rows from Output
In some situations, you might want to display only
the unique values or combinations of values in the column(s) listed
in the SELECT clause. You can eliminate duplicate rows from your query
results by using the keyword DISTINCT in the SELECT clause. The DISTINCT
keyword applies to all columns, and only those columns, that are listed
in the SELECT clause. We see how this works in the following example.
Example
Suppose you want to
display a list of the unique flight numbers and destinations of all
international flights that are flown during the month.
The following SELECT
statement in PROC SQL selects the columns FlightNumber and Destination
in the table Sasuser.Internationalflights:
proc sql outobs=12; ...