Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data tabela_a;
- do i=1 to 1000;
- kolumna_a=1;
- output;
- end;
- run;
- data tabela_b;
- do i=1 to 1500 by 10;
- kolumna_b='AAA';
- output;
- end;
- run;
- *³ıczenie zbiorów;
- data z1;
- set tabela_a tabela_b indsname=zrodlo;
- zbior=zrodlo;
- run;
- data z1;
- set tabela_a(in=in1) tabela_b(in=in2);
- z1=in1;
- z2=in2;
- run;
- *interleaving;
- proc sort data=tabela_a out=tabela_a;
- by i;
- run;
- proc sort data=tabela_b out=tabela_b;
- by i;
- run;
- data z2;
- set tabela_a tabela_b;
- by i;
- run;
- *merge;
- *dane musza byc posortowane;
- proc sort data=tabela_a out=tabela_a;
- by i;
- run;
- proc sort data=tabela_b out=tabela_b;
- by i;
- run;
- data z3;
- merge tabela_a tabela_b;
- run;
- *merge + klucz;
- *dane musza byc posortowane;
- *identyczne nazwy kolumn do laczenia;
- data z4;
- merge tabela_a(in=in1) tabela_b(in=in2);
- by i; *klucz;
- z1=in1;
- z2=in2;
- run;
- *inner join;
- data z4;
- merge tabela_a(in=in1) tabela_b(in=in2);
- by i; *klucz;
- if in1=1 and in2=1;
- run;
- *left join;
- data z4;
- merge tabela_a(in=in1) tabela_b(in=in2);
- by i; *klucz;
- if in1=1;
- run;
- *klucze, ktore sie nie lacza;
- data z6;
- merge tabela_a(in=in1) tabela_b(in=in2);
- by i; *klucz;
- if in1=0 or in2=0;
- run;
- *klucze wystepujace w tabela_a, ale nie wystapily w tabela_b;
- data z7;
- merge tabela_a(in=in1) tabela_b(in=in2);
- by i; *klucz;
- if in1=1 and in2=0;
- run;
- data wynik;
- set tabela_a;
- run;
- proc append base=wynik data=tabela_b force;
- run;
- libname X 'C:\Users\student\Desktop\zbiory_laczenie_sas';
- data zz1;
- set X.popularnames_2011 X.popularnames_2012 X.popularnames_2013 X.popularnames_2014 indsname=in;
- rok=in;
- run;
Add Comment
Please, Sign In to add comment