BookmarkSubscribeRSS Feed
FP12
Obsidian | Level 7

Hi.

 

I have a table A like this:

Name Amount1
aaa       32
bbb       23

Another table B like this

Name Amount2
ccc        41
ddd       14

I try to append them in a C table like this:

Name Amount1 Amount2
aaa       32               .
bbb       23               .
ccc        .                41
ddd      .                  14

I do this

data C;
set A;
run;

PROC APPEND BASE=C DATA=B force;QUIT;

And I have this two warnings:

WARNING: Variable Amount2 was not found on BASE file. The variable will not be added to the BASE file.
WARNING: Variable Amount1 was not found on DATA file.

Finally my table C doesn't have the Amount2 column.

How can I manage it?

 

Thanks for answer

2 REPLIES 2
kiranv_
Rhodochrosite | Level 12

proc appends by name as you have different names as amount1 and amount2, they are trated as sperate variables. you have 2 options here. First one  is rename amount 2 to amount1 or  do insert as insert does not care for names and appending is done by position

 

proc sql;

insert into tableA

select * from tableB;

Reeza
Super User

PROC APPEND cannot add new variables.

If that's what you need use either a data step or SQL union.

 

data want;

set tableA tableB;

run;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 2 replies
  • 12187 views
  • 1 like
  • 3 in conversation