BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
eagles_dare13
Obsidian | Level 7

When I write:

data work.temp;

   set work.temp1

       work.temp2

       work.temp3;

   keep col1 col2 col3 col4 col5;

run;

Will it only keep unique rows in the final output or will it keep duplicates? Also how is the above code different from proc append?

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

No, it will not.  Use proc sort with nodupkey, or SQL distinct to get rid of duplicates.

You code will create a new file, open each in the set and write out to the new file.  Not very read/write optimized.  Proc append doesn't open the file, just sets them together so less I/O operation.  The proc append will throw warnings if  the dataset formats are not exact or if there are more variables.  Dataset will warn on some things, but will expand the output table with any new columns without warning.  Best check the guidance for complete run down as there are plus/minus points on each/

View solution in original post

1 REPLY 1
RW9
Diamond | Level 26 RW9
Diamond | Level 26

No, it will not.  Use proc sort with nodupkey, or SQL distinct to get rid of duplicates.

You code will create a new file, open each in the set and write out to the new file.  Not very read/write optimized.  Proc append doesn't open the file, just sets them together so less I/O operation.  The proc append will throw warnings if  the dataset formats are not exact or if there are more variables.  Dataset will warn on some things, but will expand the output table with any new columns without warning.  Best check the guidance for complete run down as there are plus/minus points on each/

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

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 1 reply
  • 1396 views
  • 0 likes
  • 2 in conversation