zzzzqqq

Untitled

Oct 25th, 2017
332
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Set the graphics environment */
  2. goptions reset=all ;
  3.  
  4. pattern1 color=white;
  5. pattern2 color=blue;
  6. pattern3 color=green;
  7. pattern4 color=yellow;
  8. pattern5 color=pink;
  9. PROC IMPORT OUT= WORK.aa
  10.   DATAFILE= "C:\Users\Chengeng.tian\Desktop\a.csv"
  11.   DBMS=CSV REPLACE;
  12.   GETNAMES=YES;
  13.   DATAROW=2;
  14. RUN;
  15.  
  16. proc transpose data=aa out=bb;
  17. by x;
  18. var g0 g1 g2 g3 g4;
  19. run;
  20.  
  21. data cc ;
  22. set bb;
  23. fromgrade = x;
  24. tograde = input(compress(_name_,,"kd"),best.);
  25. run;
  26. proc sort data=cc;
  27.   by fromgrade tograde;
  28. run;
  29.  
  30. data dd;
  31.   set cc;
  32.   by fromgrade tograde;
  33.   if first.fromgrade then pct=0;
  34.   pct + col1*3;
  35. run;
  36.  
  37. proc sql ;
  38. create table ee as
  39. select *,sum(col1*3) as sum
  40. from dd
  41. group by x;
  42. quit;
  43. data ff;
  44. set ee;
  45. pct1 = pct - sum/2;
  46. run;
  47.  
  48.   symbol1 interpol=join repeat=3;
  49.  
  50. /* Generate the graph */
  51. proc gplot data=dd;
  52.   plot pct*fromgrade=tograde / areas=4 legend=legend1
  53.   haxis=axis1 vaxis=axis2;
  54. run;
  55. quit;
  56.  
  57. proc gplot data=ff;
  58.   plot pct1*fromgrade=tograde / areas=5 nolegend
  59.   haxis=axis1 vaxis=axis2;
  60. run;
  61. quit;
  62. /*============================================================================================================================================*/
  63.  
  64. proc sort data = ff ;
  65.   by _name_ x;
  66. run;
  67.  
  68. data fff;
  69.   set ff;
  70.   by _name_ x;
  71.   if tograde in (1 2 3 4) then do;
  72.   id = tograde-1;
  73.   or=5-x;
  74.   or2=x;
  75.   output;
  76.   end;
  77.   if tograde ne 4 then do;
  78.   id = tograde;
  79.   or=5-x;
  80.   or2=5-x;
  81.   output;
  82.   end;
  83. run;
  84.  
  85. proc sort data = fff ;
  86.   by id _name_ or2;
  87. run;
  88.  
  89. data anno;
  90.  set fff (keep=id pct1 or _name_ where=(_name_ in ("g0"))) ;
  91.  length function $ 8 ;
  92.  retain  x1space "datavalue" y1space "datavalue" x2space "datavalue" y2space "datavalue" linecolor "black" LINETHICKNESS 1;
  93.  function = "Line";
  94.  y1=or;x1=-pct1;
  95.  y2=or;x2=pct1;
  96.  output;
  97.  function = 'text';
  98.  label = 'dsaf';
  99.  output;
  100.   y1=or;x1=pct1;
  101.   function = 'text';
  102.  label = 'dsaf';
  103.  output;
  104. run;
  105.  
  106. proc sgplot data=fff sganno=anno;
  107.   polygon id=id x=pct1 y=or /
  108.   dataSkin=matte fillattrs=(transparency=0.5)
  109.   group=id fill name='foo';
  110.   keylegend / location=inside position=topleft;
  111.   run;
RAW Paste Data