07-12-2012 03:02 PM
I have two sets of SAS tables in the attached Excel file. I want to integrate observations from table 1 to table 2 one-to-one. What existed SAS statement able to do it?
Message was edited by: Dow Chang
07-12-2012 05:52 PM
Thank you, Reeza
Yes, MERGE and By statements can do one-to-one merging as the SAS Learning Module shown.
That is Match-Merging.
But, my problem is the Non-Match-Merging.
I would like to see the merging result of two tables in the attached Excel file, if you have it.
You may need an algorithm in programming.
Or you have better ideas?
Please correct me if I am wrong.
07-12-2012 05:44 PM
Hi ... the two tables have the same variable names and different numbers of observations (881 and 896). When you say integrate one-to-one, just what do you mean?
07-12-2012 06:36 PM
You've provided the input, but you need to provide an example of what the output would look like.
You can also merge without specifying a by statement, If you just want the two tables side by side, merge without a by but then you'll need to rename all the columns in one of the tables because they have the same names.
merge sashelp.class sashelp.class( keep=name age sex rename = (name=name2 age=age2 sex=sex2));
07-12-2012 09:16 PM
I provide you with only a part of the output. You can find them in the two tables.
As the example shown, the purpose of this merge is to link observations one-to-one for a piece of information; Obs, in table 2 only.
The total output can be produced, but not in SAS at this time.
I would like to know how to produce in the SAS.
Thanks for your comments,
07-12-2012 09:57 PM
The code example I showed would work in your case then, you just need to change the rename parts
merge have have (rename= (state=state_d county=count_d etc...);
07-13-2012 11:14 PM
Your help is highly appreciated.
I wish the code that you offered able to get the accurate output.
The only way to find out is to run your code and get outputs.
I cannot run SAS codes now.
I already have the output for the attached two new tables, yet it is not produced in SAS.
I would like to compare other outputs to my output.
Thanks for anyone who may concern.