BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Reeza
Super User

@novinosrin wrote:

 

 

noduprecs =  select distinct * and not select distinct make ,type, origin

 

which apparently means the from table should only have the vars making it distinct and cannot support dataset option at execution time for noduprecs to work. Well, well what a nit!

 


Not quite, the order of the input data set matters a lot when using NODUPRECS, which is not intuitive. NODUPRECS only check the previous record, so if the data isn't sorted first it won't work either. 

 

This is another way to get what the OP wants, with a double sort.

 

proc sort data=sashelp.cars (keep=MAKE TYPE ORIGIN) out=dsout;
by MAKE TYPE;
run;

proc sort data=dsout noduprec;
by MAKE TYPE;
run;

*want only 1;
proc freq data=dsout;
table make*type / list;
run;

*get only 1;
proc freq data=dsout;
table make*type*origin / list;
run;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 15 replies
  • 3517 views
  • 13 likes
  • 6 in conversation