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

 

Hello

Lets say that I have data set A and every day I create another data set called B and then I want to add the rows of B to A.

I want to show 2 ways and ask which way is better ?

 


/*Way1*/
Data A;
SET A B;
Run;
/*Way2*/
Data tempTbl;
SET A;
Run;
Proc delete data=A;Run;
Data A;
SET tempTbl B;
Run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@Ronein wrote:

 

Hello

Lets say that I have data set A and every day I create another data set called B and then I want to add the rows of B to A.

I want to show 2 ways and ask which way is better ?

 


/*Way1*/
Data A;
SET A B;
Run;
/*Way2*/
Data tempTbl;
SET A;
Run;
Proc delete data=A;Run;
Data A;
SET tempTbl B;
Run;

 


Proc append if the data sets have the same variables with the same lengths for character variables would be the better choice.

Anything involving a data step reads each and every record. Which means your "Set A B"; runs slower and slower as A bets bigger.

Proc Append works a bit differently and will typically run much faster for this type of activity.

 

If the variables are not the same then the first way would be more efficient in resources.

View solution in original post

1 REPLY 1
ballardw
Super User

@Ronein wrote:

 

Hello

Lets say that I have data set A and every day I create another data set called B and then I want to add the rows of B to A.

I want to show 2 ways and ask which way is better ?

 


/*Way1*/
Data A;
SET A B;
Run;
/*Way2*/
Data tempTbl;
SET A;
Run;
Proc delete data=A;Run;
Data A;
SET tempTbl B;
Run;

 


Proc append if the data sets have the same variables with the same lengths for character variables would be the better choice.

Anything involving a data step reads each and every record. Which means your "Set A B"; runs slower and slower as A bets bigger.

Proc Append works a bit differently and will typically run much faster for this type of activity.

 

If the variables are not the same then the first way would be more efficient in resources.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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