02-18-2015 11:13 AM
Can someone tell me the most efficient way to merge two dataset with multiple variable length (either by variable or other common variable to be merged). Is there a macro that will solve this problem for any variable within the dataset?
I defined the output variable length as follows, and it still does not work.
length Country$ 12.;
merge one two;
NOTE: my right table (two) by variable length is 12 and left table (one) by variable length is 10
02-18-2015 11:23 AM
Are you sure it's an ERROR?
You just need to "fix" the lengths such that they match in both data sets or you could use the SAS system option to turn off the message and ignore this issue.
Perhaps someone has such a macro as you suggest or you can make your own. Quite simple I should think.
02-18-2015 11:24 AM
I am sure you can find a macro to do this on google.
And Art Carpenter's book has a macro for EVERYHTING... Carpenter's Complete Guide to the SAS® Macro Language, Second Edition
If you don't have a lot of variables just choose a length.
length country $25;
merge dataone datatwo;
When you have a chance, take the programming 1 class and this certification: SAS Global Certification: SAS Certified Base Programmer