Advertisement
Guest User

Untitled

a guest
Dec 1st, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SAS 3.57 KB | None | 0 0
  1. /* Tri de la table mmse_result par patient et numéro de visite */
  2. /* SORTSEQ + numeric_collation : permet le tri de la colonne visdesc */
  3. PROC SORT DATA = Source.mmse_result OUT = SOurce.mmse_result_ordered SORTSEQ=linguistic (numeric_collation=on);
  4.   BY USUBJID VISID;
  5. RUN ;
  6.  
  7. /* 2.4.1 */
  8.  
  9. PROC SORT DATA = Source.mmse_result OUT = source.tableTriee ;
  10.   BY USUBJID VISID ;
  11. RUN ;
  12. PROC TRANSPOSE DATA = Source.tableTriee OUT = Source.qst ;
  13.   BY USUBJID VISID;
  14.   VAR MMSED1 MMSED2 MMSED3 MMSED5 MMSED6 MMSED7 MMSED8 MMSED9 MMSED10 MMSED11 MMSED12 ;
  15. RUN ;
  16. PROC TRANSPOSE DATA = Source.tableTransposee OUT = Source.score PREFIX=Score ;
  17.   BY USUBJID VISID ;
  18.   VAR  MMSES1 MMSES2 MMSES3 MMSES5 MMSES6 MMSES7 MMSES8 MMSES9 MMSES10 MMSES11 MMSES12;
  19. RUN ;
  20. DATA Source.FIN ;
  21.   MERGE Source.qst Source.score ;
  22.   BY USUBJID VISID ;
  23. RUN ;
  24. PROC PRINT DATA=SOurce.fin LABEL NOOBS;
  25.  
  26. /*2.4.2*/
  27.  
  28. /* Transposition des scores par visites */
  29. PROC TRANSPOSE DATA=Source.mmse_result_ordered OUT=Source.mmse_transposed_visit_answer(DROP=_name_ _label_) PREFIX=Visite_ ;
  30.     BY usubjid;
  31.     VAR MMSES1-MMSES3 MMSES5-MMSES12;
  32.     ID visid;
  33. RUN;
  34.  
  35. /* Fusion des deux tables */
  36. /* On réexploite la table transposée des questions */
  37. DATA Source.mmse_merged_2412; /* 2412 référence le # de question */
  38. MERGE Source.fin(IN=mark1) Source.mmse_transposed_visit_answer(IN=mark2);
  39. BY usubjid;
  40. IF mark1 THEN OUTPUT;
  41. RUN;
  42.  
  43. /* Affichage de la table de résultat */
  44. /* missing : remplace les valeures nulles */
  45. Option missing="";
  46. DATA Source.mmse_q LABEL;
  47. SET Source.mmse_merged_2412;
  48. DROP visid;
  49. ATTRIB usubjid
  50.     LABEL = "N° du patient";
  51. ATTRIB Q1
  52.     LABEL = "Question";
  53. RUN;
  54.  
  55. PROC PRINT DATA=Source.mmse_q NOOBS LABEL;
  56. TITLE "MMSE - Scores par visite d'une question, groupés par patient";
  57. RUN;
  58.  
  59.  
  60.  
  61. /* 2.4.3 */
  62.  
  63. PROC SORT DATA= Source.mmse_result OUT=source.int;
  64.     BY USUBJID VISID;
  65. RUN;
  66. PROC TRANSPOSE DATA = Source.int OUT = Source.deux PREFIX=sco ;
  67.     BY USUBJID VISID;
  68.     VAR  MMSES1 MMSES2 MMSES3 MMSES5 MMSES6 MMSES7 MMSES8 MMSES9 MMSES10 MMSES11 MMSES12;
  69. RUN;
  70.  
  71. proc sort data=Source.deux;
  72. by USUBJID VISID;
  73. run;
  74.  
  75. data Source.MMSE_ScoreInt(keep=USUBJID VISID score);
  76. set Source.deux;
  77. retain score;
  78. by USUBJID VISID;
  79. if first.VISID then score=sco1;
  80. else score=score+sco1;
  81. if last.VISID;
  82. run;
  83.  
  84.  
  85. DATA Source.groupesT;
  86. SET Source.treatment_assignment(Keep=USUBJID TRTCD);
  87. RUN;
  88.  
  89. DATA Source.groupesT2;
  90. SET Source.groupesT;
  91. Attrib numGroupe LABEL="Numéro de groupe en Numérique";
  92.     numGroupe = input(TRTCD,20.6);
  93.     numGroupe=TRTCD;
  94. RUN;
  95.  
  96. PROC PRINT DATA=Source.groupesT2 LABEL NOOBS;
  97.  
  98. PROC SQL ;
  99. create table Source.MMSE_Score as
  100. select a.*, b.*
  101. from Source.MMSE_ScoreInt as a left join Source.groupesT2 as b on a.USUBJID=b.USUBJID
  102. ORDER BY USUBJID, VISID;
  103. QUIT ;
  104.  
  105. PROC PRINT DATA=Source.MMSE_Score LABEL NOOBS;
  106.  
  107. /*2.4.4*/
  108.  
  109. PROC CORR DATA=Source.MMSE_Score KENDALL;
  110.    
  111. /*Proche de 0, donc il y a une corrélation*/
  112.  
  113. RUN;
  114.  
  115.  
  116. /*2.4.5*/
  117.  
  118. VAR  score numGroupe;PROC SQL ;
  119. create table Source.MMSE_freq  as
  120. Select score
  121. from Source.MMSE_Score
  122. where VISID = (Select min(VISID)
  123.                 From Source.MMSE_Score)
  124. GROUP BY USUBJID
  125. QUIT;
  126.  
  127. PROC PRINT DATA=Source.MMSE_freq  LABEL NOOBS;
  128.  
  129. data Source.MMSE_freq ;
  130. set Source.MMSE_SCORE;
  131. by USUBJID;
  132. if first.USUBJID or last.USUBJID;
  133. run;
  134.  
  135. PROC PRINT DATA=Source.MMSE_freq  LABEL NOOBS;
  136.  
  137. /*2.4.6*/
  138.  
  139.  
  140. PROC TRANSPOSE DATA = Source.MMSE_freq OUT = Source.SixFin ;
  141.   BY USUBJID ;
  142.   VAR score ;
  143. RUN ;
  144.  
  145. PROC PRINT DATA=Source.SixFin  LABEL NOOBS;
  146.  
  147. proc freq data=Source.SixFin;
  148.    table COL1*COL2/ norow nocol;
  149.  ;
  150.  
  151. run;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement