BookmarkSubscribeRSS Feed
rawindar
Calcite | Level 5

Can anybody tell me the differnces between SET and APPEND.Thanks in advance

5 REPLIES 5
sambasiva_ravuri_tcs_com
Calcite | Level 5

SET statement is used to read Input/Records.

APPEND is A proc in SAS.

PROC APPEND BASE=SAS-data-set DATA=SAS-data-set;
RUN;
where
BASE=SAS-data-set
names the data set to which you want to add observations.
DATA=SAS-data-set
names the SAS data set containing observations that you want to append to the end of the
SAS data set specified in the BASE= argument.


PROC APPEND reads only the data in the DATA= SAS data set, not the BASE= SAS
data set. PROC APPEND concatenates data sets even though there may be variables in
the BASE= data set that do not exist in the DATA= data set.
When the BASE= data set contains more variables than the DATA= data set, missing
values for the additional variables are assigned to the observations that are read in
from the DATA= data set and a warning message is written to the SAS log.

Let me know if you have any questions.

Regards,

S Ravuri.

ballardw
Super User

Proc Append won't add any variables that do not exist in the base dataset. However it is faster for adding records than using SET in a datastep.

rawindar
Calcite | Level 5

thank....u.I have one doubt we can add any no of datasets at a time.In the same way is can we add more than one datasets at a time using APPEND .I tried but i didnt get is there any way.

If we wanna do append using APPEND/SET there must be same variables names,with out a same variable names we cant append is this right?

Thanks & regards

Rawindarreddy

chirag_sachdeva
Calcite | Level 5

You can use a macro to append multiple datasets together using PROC APPEND.

But SET statement will do the trick without the macro as well.

It'll take a little bit of time to code the macro but overall efficiency of the MACRO will be better compared to SET statement with multiple datasets.

 

 

(PS: I know this post is way too old)

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 14042 views
  • 6 likes
  • 5 in conversation