I have 2 tables I want to append and not sure how to do it. Example of table 1
who svcd svdesc admission count
1111 1 major no 2
1111 1 major yes 1
2222 3 extreme no 5
2222 3 extreme yes 1
table 2
who svcd svdesc admission count
national 1 major no 6000
national 1 major yes 12
national 3 extreme no 5000
national 3 extreme yes 5
Table 2 only have a total of 10 rows and I want to append it to table 1 which has like 139k rows.
I tried a merge but have no primary key to really use that I can see
Question: for variable 'who', are they the same type(char) in both tables? if not, proc append is not gonna cut it. if yes, are they the same length? if not, truncating may happen.
Otherwise,
proc append base=table1 data=table2 force;
run;
or use proc datasets or proc sql ; insert into
Regards,
Haikuo
Question: for variable 'who', are they the same type(char) in both tables? if not, proc append is not gonna cut it. if yes, are they the same length? if not, truncating may happen.
Otherwise,
proc append base=table1 data=table2 force;
run;
or use proc datasets or proc sql ; insert into
Regards,
Haikuo
The who is text in both but 1 is 9 characters and the other is set to 8. i guess i could change it to 9 would that help?
if base table has the longer length, you don't need to do anything, otherwise, you need to modify the length in base table to the length in the table to be appended.
The proc append did not work due to length. How do I do an insert into?
did you try to use the 'force' option?
Yes I did
Are you certain that it did not 'append' or it did but with a warning about 'length' problem? If it was the later and the warning really bothers you, you can turn it off by adding option 'NOWARN' after 'force'.
It would be ideal if you could post your code along with your error log.
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 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.