BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
BrahmanandaRao
Lapis Lazuli | Level 10
*Run appending process by SQL;
data apnd1;
input Siteno $ Subid Age;
cards;
S1		101 23
S1		102 46
S1		103 56
;
run;

data apnd2;
input Siteno $ Subid Age;
cards;
S2		201 23
S2		202 46
S2		203 56
;
run;

/*Run Appending*/
proc sql;
insert into apnd1;
select * from apnd2;
quit;
1 ACCEPTED SOLUTION

Accepted Solutions
unison
Lapis Lazuli | Level 10

Remove ";" after insert into. As in:

data apnd1;
	input Siteno $ Subid Age;
	cards;
S1 101 23
S1 102 46
S1 103 56
;
run;

data apnd2;
	input Siteno $ Subid Age;
	cards;
S2 201 23
S2 202 46
S2 203 56
;
run;

proc sql;
	insert into apnd1 select * from apnd2;
quit;

proc print noobs data=apnd1;
run;
-unison

View solution in original post

4 REPLIES 4
unison
Lapis Lazuli | Level 10

Remove ";" after insert into. As in:

data apnd1;
	input Siteno $ Subid Age;
	cards;
S1 101 23
S1 102 46
S1 103 56
;
run;

data apnd2;
	input Siteno $ Subid Age;
	cards;
S2 201 23
S2 202 46
S2 203 56
;
run;

proc sql;
	insert into apnd1 select * from apnd2;
quit;

proc print noobs data=apnd1;
run;
-unison
BrahmanandaRao
Lapis Lazuli | Level 10
ThanK you
Unison
In proc append we can append only two datasets in datastep we can append 100 datasets with set statement
so how many datasets we can append using proc sql method like above code
Kurt_Bremser
Super User

There is no defined limit to the number of INSERT statements you can write in SQL.

 

But it's wrong that PROC APPEND can only append one dataset in one operation; create a data step view containing all the datasets to be appended, and use that in the DATA= option of PROC APPEND.

andreas_lds
Jade | Level 19

Why do you want to write more code than necessary? Proc append is designed for appending dataset, use it!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 535 views
  • 1 like
  • 4 in conversation