Advertisement
epiphytools

sas_reshaping wide_long

May 14th, 2015
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. /*PROC IMPORT OUT= WORK.PF */
  2. /* DATAFILE= "T:\Profundidades.xlsx" */
  3. /* DBMS=EXCEL REPLACE;*/
  4. /* RANGE="Plan1$"; */
  5. /* GETNAMES=YES;*/
  6. /* MIXED=NO;*/
  7. /* SCANTEXT=YES;*/
  8. /* USEDATE=YES;*/
  9. /* SCANTIME=YES;*/
  10. /*RUN;*/
  11.  
  12. DATA PF;
  13. INPUT PONTO P20 P150 PONTO1 P201 P1501;
  14. DATALINES;
  15. 1 12 6 21 3 0
  16. 2 9 4 22 9 1
  17. 3 14 5 23 13 11
  18. 4 10 7 24 11 3
  19. 5 11 6 25 12 10
  20. 6 13 7 26 16 6
  21. 7 14 8 27 9 10
  22. 8 13 7 28 6 0
  23. 9 11 13 29 10 7
  24. 10 12 7 30 7 3
  25. 11 11 10 31 11 11
  26. 12 11 5 32 14 6
  27. 13 13 10 33 10 11
  28. 14 13 8 34 13 14
  29. 15 11 5 35 15 17
  30. 16 8 11 36 3 0
  31. 17 7 7 37 13 10
  32. 18 11 3 38 10 0
  33. 19 13 4 39 2 0
  34. 20 7 0 40 14 9
  35. ;
  36. PROC PRINT DATA=PF; RUN;
  37.  
  38. DATA A;
  39. SET PF;
  40. DROP Ponto1 P201 P1501; OUTPUT;
  41. RUN;
  42. PROC PRINT DATA=A; RUN;
  43.  
  44. DATA B;
  45. SET PF;
  46. DROP Ponto P20 P150; OUTPUT;
  47. RENAME PONTO1=PONTO;
  48. RENAME P201=P20;
  49. RENAME P1501=P150;
  50. RUN;
  51. PROC PRINT DATA=B; RUN;
  52.  
  53. DATA C ;
  54. SET A B;
  55. DIF=P20-P150;
  56. PROC PRINT DATA=C; RUN;
  57.  
  58. PROC UNIVARIATE DATA=C NORMAL ;
  59. VAR DIF ;
  60. RUN ;
  61. /*goptions reset=all border cback=white htitle=12pt htext=10pt;*/
  62.  
  63. DATA C;
  64. do PONTO=1 to 40;
  65. P20=round(ranuni (20);
  66. P150=round(ranuni(20);
  67. output; end;
  68. run;
  69.  
  70. symbol1 interpol=join value=squarefilled color=vibg height=1;
  71. symbol2 interpol=join value=trianglefilled color=depk height=1;
  72. legend1 label=none frame;
  73. axis1 label=("Pontos") minor=none offset=(1,1);
  74. axis2 label=(angle=90 "No de organismos por litro de água")
  75. order=(0 to 20 by 2) minor=(n=1);
  76.  
  77. proc gplot data=C;
  78. plot (P20 P150)*PONTO / overlay legend=legend1
  79. haxis=axis1 vaxis=axis2;
  80. run;
  81. quit;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement