Question: Merge two or more datasets

Let say that you have two datasets:

restart:
with(MyFinance):
z1 := GetCSV("http://www.quandl.com/api/v1/datasets/USER_18Q/18R.csv?&auth_token=BXckVSG3twWkV272c9Q4&trim_start=1968-04-01&trim_end=2013-04-12&collapse=daily&transformation=rdiff&sort_order=desc");
z2 := GetCSV("http://www.quandl.com/api/v1/datasets/USER_18Q/1EV.csv?&auth_token=BXckVSG3twWkV272c9Q4&trim_start=1994-01-03&trim_end=2013-04-12&collapse=daily&transformation=rdiff&sort_order=desc");

              dataset1                                                            dataset2

date                    stock1    stock2                  date                  stock1       stock2
2012-01-05           67         56                       2012-03-01        34              98
.........                  ....          ....                     ......                  .....            ......


What would the best way be to merge them into one dataset? I mean I can do it in a primitive
way and simply fill out one matrix with "" (missing observation) so the two matrices have the same
dimensions and then simply merge them. However, it might be problematic if the dates are different
ie different bank holidays (usa bank holidays might be different than germany) or if the last date in two 
data files are different.

I would like a more sofisticated automated way where the date of each observations are checked
so they are equal and then a new column is created where the new data is stored on that partical row.
One matrix also needs to be fill out with "" (missing observation) so the two matrices have the same
dimensions. Such process might be resource intensive but I feel it is needed to ensure data integrety.

Please Wait...