hi,
I need help while merging multiple datasets. I have 6 datasets as following:
Dataset a | | | | | | | | |
id | age | in_2012 | | | | | | |
1 | 30 | Y | | | | | | |
Dataset b | | | | | | | | |
id | age | in_2013 | | | | | | |
| | | | | | | | |
Dataset c | | | | | | | | |
id | age | in_2014 | | | | | | |
1 | 32 | Y | | | | | | |
Dataset d | | | | | | | | |
id | age | in_2015 | | | | | | |
1 | 33 | Y | | | | | | |
Dataset e | | | | | | | | |
id | age | in_2016 | | | | | | |
1 | 34 | Y | | | | | | |
Dataset f | | | | | | | | |
id | age | in_2017 | | | | | | |
1 | 35 | Y | | | | | | |
Dataset g | | | | | | | | |
id | age | in_2018 | | | | | | |
1 | 36 | Y | | | | | | |
| | | | | | | | |
Final output | | | | | | | |
id | age | in_2012 | in_2013 | in_2014 | in_2015 | in_2016 | in_2017 | in_2018 |
1 | 30 | Y | | | | | | |
1 | 32 | | | Y | | | | |
1 | 33 | | | | Y | | | |
1 | 34 | | | | | Y | | |
1 | 35 | | | | | | Y | |
1 | 36 | | | | | | | Y |
Subject Id 1 has record present from 2012 to 2018 hence we have variable in_2012... to in_2018.
When i am merging the above 6 datasets by id and age , i am getting the above output.
Can anyone pl guide me how can i get the output with the variable in_2012 to in_2018 has "Y" in all the rows(if records are available in all datasets) and not in selective rows as presented above.
This is the ouput which i want:
id | age | in_2012 | in_2013 | in_2014 | in_2015 | in_2016 | in_2017 | in_2018 |
1 | 30 | Y | | Y | Y | Y | Y | Y |
1 | 32 | Y | | Y | Y | Y | Y | Y |
1 | 33 | Y | | Y | Y | Y | Y | Y |
1 | 34 | Y | | Y | Y | Y | Y | Y |
1 | 35 | Y | | Y | Y | Y | Y | Y |
1 | 36 | Y | | Y | Y | Y | Y | Y |
Thanks,
Jeetender