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;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 5165 views
  • 13 likes
  • 6 in conversation