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;
@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.
@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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.