Advertisement
mkachad

Untitled

Feb 26th, 2021
2,551
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SAS 0.57 KB | None | 0 0
  1. PROC IMPORT DATAFILE="C:\SASDATA\labs_wide.csv"
  2.     OUT=SASDATA.labs_wide
  3.     DBMS=csv
  4.     REPLACE;
  5.     GUESSINGROWS=5000;
  6.     GETNAMES=yes;
  7. RUN;
  8.  
  9. PROC SORT DATA=sasdata.labs_wide
  10.     OUT=labs2
  11.     NODUPKEY DUPOUT=duplicates;
  12.     BY _ALL_;
  13. RUN;
  14.  
  15. PROC TRANSPOSE DATA=labs2
  16.     OUT=labs3
  17.     NAME=Test
  18.     PREFIX=Value;
  19.     BY ID Name "Test Date"n;
  20. RUN;
  21.  
  22. DATA labs4;
  23.     SET labs3;
  24.     F_Name = SCAN(Name,1,' ');
  25.     L_Name = SCAN(Name,2,' ');
  26.     RENAME Value1=Value;
  27. RUN;
  28.  
  29. DATA sasdata.labs_long;
  30.     RETAIN ID F_Name L_Name "Test Date"n Test Value;
  31.     DROP Name;
  32.     SET labs4;
  33.     IF Value= . THEN Delete;
  34. RUN;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement