Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data z1;
- put _ALL_;
- set sashelp.class;
- put _ALL_;
- weight2 = weight / 2;
- put _ALL_;
- run;
- *zliczenia;
- *chcemy obliczyć wartość samochodów w help.cars;
- data z2;
- set sashelp.cars end=koniec;
- retain total 0; /* zapamiętaj zmienna wartość_po */
- total = total + invoice;
- /* total + invoice */
- if koniec then output;
- run;
- *przetwarzanie w grupach;
- proc sort data = sashelp.cars out=cars;
- by make; /* zmienna grupująca */
- run;
- data z3;
- set cars;
- by make; /* przetwarzanie w grupach */
- col1 = first.make;
- col2 = last.make;
- run;
- data z3;
- set cars;
- by make; /* przetwarzanie w grupach */
- /*col1 = first.make;
- col2 = last.make; */
- if first.make then do;
- licznik = 0;
- suma = 0;
- end;
- licznik + 1;
- suma + invoice;
- if last.make then output;
- keep make licznik suma;
- run;
- *sashelp.air;
- data z4;
- set sashelp.air;
- rok = year(date);
- run;
- Proc sort data = z4 out = z4;
- by rok;
- run;
- data z5;
- set z4;
- by rok;
- if first.rok then suma = 0;
- suma + air;
- if last.rok then output;
- keep rok suma;
- run;
- *podaj 3 najdroższe auta dla każdej marki;
- proc sort data=sashelp.cars out=cars;
- by make descending invoice;
- run;
- data z6;
- set cars;
- by make;
- if first.make then licznik = 0;
- licznik + 1;
- if licznik <= 3 then output;
- run;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement