Help using Base SAS procedures

Determining unique combination from a set of variables

Accepted Solution Solved
Reply
Contributor
Posts: 27
Accepted Solution

Determining unique combination from a set of variables

Is there a simple way to obtain all possible unique covariate patterns (i.e. unique combinations of variables) given a set of variables, say var1 to varN?

Thanks,

John


Accepted Solutions
Solution
‎05-21-2014 05:41 PM
Respected Advisor
Posts: 3,893

Re: Determining unique combination from a set of variables

proc sort data=have out=want nodupkey;

     by <var1  to varN>;

run;

or:

proc sql;

     create table want as

     select DISTINCT <var1 to varN>

     from have

     ;

quit;

View solution in original post


All Replies
Solution
‎05-21-2014 05:41 PM
Respected Advisor
Posts: 3,893

Re: Determining unique combination from a set of variables

proc sort data=have out=want nodupkey;

     by <var1  to varN>;

run;

or:

proc sql;

     create table want as

     select DISTINCT <var1 to varN>

     from have

     ;

quit;

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 297 views
  • 0 likes
  • 2 in conversation