Posted By

webonomic on 05/03/08


Tagged

merge dataset


Versions (?)

Merge datasets with unlike variable names


 / Published in: SAS
 

URL: http://jaredprins.squarespace.com/blog/2008/5/3/merge-datasets-with-unlike-variable-names.html

  1. Data DS1;
  2. INPUT A $ B $ C $ ;
  3. Cards ;
  4. Small Tike Red
  5. Med Bike Blue
  6. Large Bike Red
  7. ;
  8.  
  9. Data DS2 ;
  10. INPUT X $ Y $ Z $ ;
  11. Cards ;
  12. Small 10.99 1yr
  13. Small 20.99 2yr
  14. Large 50.00 1yr
  15. ;
  16.  
  17. run;
  18.  
  19. proc sql;
  20. create table AllDS as
  21. select coalesce(ds1.a,ds2.x) as ax, b, c, y, z
  22. from ds1 full join ds2
  23. on ds1.a = ds2.x
  24. order by ax desc;
  25. quit;

Report this snippet  

You need to login to post a comment.