Advertisement
leannemcn13

keep only variables that exists

Dec 14th, 2017
1,322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SAS 0.73 KB | None | 0 0
  1. *list of variables needed;
  2. %let keeplist= "STUDYID","USUBJID","MHSPID","MHSEQ","MHTERM","MHLLT","MHLLTCD","MHDECOD","MHPTCD","MHHLT","MHHLTCD","MHHLGT","MHHLGTCD","MHBODSYS",
  3. "MHBDSYCD","MHSOC","MHSOCCD","MHCAT","MHSCAT","MHENRTPT","MHENTPT ","MHSTRTPT","MHSTTPT ","MHPRESP","MHOCCUR","DIAGAGE","DIAGMETH",
  4. "DNASPMUT","DNASPEXN","DNASPPLY","MHAGEST","MHAGEEN";
  5.  
  6. *bring in sdtm;
  7. %qc_combinesdtm(dsnam=mh);
  8.  
  9. data admh1;
  10.  set mh(in=a);
  11.   by usubjid;
  12.   if a;
  13.  
  14.   adadiage= input(diagage, best.);
  15.   adameth= diagmeth;
  16.  
  17.  
  18. run;
  19.  
  20. *variables that are populated;
  21. proc sql noprint;
  22.   select name
  23.   into: newkeeplist separated by ", "
  24.   from sashelp.vcolumn
  25.   where libname= "WORK" and memname="ADMH1" and name in (&keeplist);
  26. quit;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement