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

 

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.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 913 views
  • 2 likes
  • 2 in conversation