BookmarkSubscribeRSS Feed
tmm
Fluorite | Level 6 tmm
Fluorite | Level 6

I have two tables and one of them I want to copy all the data into the base table. both tables have same rows, column headers and all.

The base table called X has 5798 rows with 9 columns and the table I want to copy to this base table is table Y and has 94 rows with 9 columns. I want to take table Y and copy all the data into table X. I tried append but since the primary key is the same even using the force did not work. It comes back and says it was successful yet then says final outcome is 5798 rows. I never says 5892 rows.

proc append base = y data = x force;

run;

2 REPLIES 2
Reeza
Super User

Show the log from the following code:

proc append base=x data=y force;

run;

proc sql;

     create table new_selection as

(select * from x

union all

select * from y) b;

quit;

Alpay
Fluorite | Level 6

Do you have a unique index on the data set X? Can you run a proc contens on the data set X and share the log with us?

If so and Y data set has observations that match the key variable values in data set X it will reject those observations in Y when appended.

data class;

    set sashelp.class;

run;

proc sql;

    create unique index Name on class ;

quit;

proc contents data=class; run;

proc append base=class data=sashelp.class;

run;

NOTE: Appending SASHELP.CLASS to WORK.CLASS.

WARNING: Duplicate values not allowed on index Name for file CLASS, 19 observations rejected.

NOTE: There were 19 observations read from the data set SASHELP.CLASS.

NOTE: 0 observations added.

NOTE: The data set WORK.CLASS has 19 observations and 5 variables.

NOTE: PROCEDURE APPEND used (Total process time):

      real time           0.00 seconds

      cpu time            0.00 seconds

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 2 replies
  • 1733 views
  • 0 likes
  • 3 in conversation