To answer this question, we need to understand how to remove duplicate values from a query output in PROC SQL.
Option A) proc sql nodup; select membertype from sasuser.frequentflyers;
- This option is incorrect. The nodup
keyword in PROC SQL is used to remove duplicate rows, not duplicate values within a single column. Therefore, this query will not remove duplicate values of MemberType.
Option B) proc sql; select distinct(membertype) as MemberType from sasuser.frequentflyers;
- This option is incorrect. The distinct
keyword is used to remove duplicate values from a column in the query output. This query will remove duplicate values of MemberType and provide only the unique values.
Option C) proc sql; select unique membertype from sasuser.frequentflyers group by membertype;
- This option is incorrect. The unique
keyword is not used in PROC SQL to remove duplicate values. This query will not remove duplicate values of MemberType.
Option D) proc sql; select distinct membertype from sasuser.frequentflyers;
- This option is correct. The distinct
keyword is used to remove duplicate values from a column in the query output. This query will remove duplicate values of MemberType and provide only the unique values.
The correct answer is Option D. This option is correct because it uses the distinct
keyword to remove duplicate values of MemberType from the query output.