Path to mathematics-sas memo (10), path to mathematics-sas memo
Merge combines two or more data sets.
Libname saslib "k: \ sas ";
DataSaslib. goodsprice;
Input id name $ price6.2;
Datalines;
1 mouse 35.6
2 Keyboard 28.95
3 mouse pad 8.2
4 headsets 29.7
;
DataSaslib. goodsquantity;
Input id quantity;
Datalines;
1 150
2 98
4 162
3 45
;
Proc sortData = saslib. goodsprice;
By id;
Proc sortData = saslib. goodsquantity;
By id;
DataSaslib. mygoods;
Merge saslib. goodspricesaslib. goodsquantity;
By id;
Run;
Proc printData = saslib. mygoods;
Run;
All content of this blog is original, if reproduced please indicate the source http://blog.csdn.net/myhaspl/
You can also use update, but update can only operate on two datasets.
Libname saslib "k: \ sas ";
DataSaslib. goodsprice;
Input id name $ price6.2;
Datalines;
1 mouse 35.6
2 Keyboard 28.95
3 mouse pad 8.2
4 headsets 29.7
;
DataSaslib. goodsquantity;
Input id quantity;
Datalines;
1 150
2 98
4 162
3 45
;
Proc sortData = saslib. goodsprice;
By id;
Proc sortData = saslib. goodsquantity;
By id;
DataSaslib. mygoods;
Update saslib. goodspricesaslib. goodsquantity;
By id;
Run;
Proc printData = saslib. mygoods;
Title 'computer peripheral production ';
Run;
Libname saslib "k: \ src \ sas ";
DataSaslib. goodsprice;
Input id name $ price6.2;
Datalines;
1 mouse 35.6
2 Keyboard 28.95
3 mouse pad 8.2
4 headsets 29.7
;
DataSaslib. goodsquantity;
Input id quantity;
Datalines;
1 150
2 98
4 162
3 45
;
Proc sortData = saslib. goodsprice;
By id;
Proc sortData = saslib. goodsquantity;
By id;
DataSaslib. mygoods;
Update saslib. goodspricesaslib. goodsquantity;
By id;
Run;
Proc printData = saslib. mygoods;
Title 'computer peripheral production ';
Run;