Advertisement
leannemcn13

Compare old lib to new lib

Nov 27th, 2019
3,261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SAS 0.63 KB | None | 0 0
  1.  
  2. libname raw "P:/Data/2019-11-26"  ;
  3. libname newraw "P:/Data/2019-11-27"   ;
  4.  
  5. *Get names of all datasets;
  6. proc contents data=raw._all_ out=raw(keep=memname name label);
  7. run;
  8.  
  9. proc contents data=newraw._all_ out=newraw(keep=memname name label);
  10. run;
  11.  
  12. *Compare contents;
  13. proc compare data=raw compare=newraw;
  14. run;
  15.  
  16. *This will compare the datasets;
  17. %macro compare;
  18. proc sql;
  19.   select count(distinct memname)
  20.   into: count trimmed
  21.   from raw;
  22.  
  23.   select distinct(memname)
  24.   into: ds1 - :ds&count
  25.   from raw;
  26. quit;
  27.  
  28. %do i= 1 %to &count;
  29. proc compare data=raw.&&ds&i compare=newraw.&&ds&i;
  30. run;
  31. %end;
  32. %mend compare;
  33. %compare;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement