Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SAS 1.24 KB | None | 0 0
  1. data z1;
  2. put _ALL_;
  3. set sashelp.class;
  4. put _ALL_;
  5. weight2=weight/2;
  6. put _ALL_;
  7. run;
  8.  
  9. *kolumny zliczeniowe,wartosc aut;
  10. data z2;
  11. set sashelp.cars;
  12.  *retain total 0; /*retain nazwa wartoล›ฤ‡*/
  13. *total = total + invoice;
  14.  
  15. total + invoice;
  16.  
  17. if koniec then output;
  18. keep total;
  19. run;
  20.  
  21. *przetwarzanie w grupach ;
  22.  
  23. proc sort data = sashelp.cars out=cars;
  24. data z3;
  25. set sashelp.cars;
  26. by make; /* przetwarzanie w grupach */
  27. *col1=first.make;
  28. *col2=last.make;
  29.  
  30. if first.make  then do;
  31. licznik =0;
  32. suma =0;
  33. end;
  34. licznik +1;
  35. suma+invoice;
  36. if last.make then output;
  37. keep make licznik suma;
  38. run;
  39.  
  40. *sashelp.air;
  41.  data z4;
  42.  set sashelp.air;
  43.  rok=year(date);
  44.  run;
  45.  
  46.  data z5;
  47.  set z4;
  48.  by rok;
  49.  
  50. if first.rok then suma =0;
  51. suma +air;
  52. if last.rok;
  53. keep rok suma;
  54.  
  55.  run;
  56.  *podaj 3 najdrozsze auta dla kazdej marki;
  57.  
  58.  proc sort data = sashelp.cars
  59.  out=cars;
  60.  by make descending invoice;
  61.  run;
  62.  
  63.  data z6;
  64.  set cars z6;
  65.  by make;
  66.  if first.make then licznik =0;
  67.  licznik +1;
  68.  if licznik <=3 then out = cars;
  69.  run;
  70.  
  71.  
  72.  
  73. proc sort data = sashelp.class;
  74.  out=class;
  75.  by make descending invoice;
  76.  run;
  77.  
  78.  data z7;
  79.  set class z7;
  80.  by height;
  81.  if first.height then output max;
  82.  
  83.  if last.height then output = min;
  84.  run;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement