SAS – Base Programming – Tutorial 1 – Sort

November 9, 2013Billy Aung MyintNo comments

*Set the library name and path. Note that this is a permanent library.
libname mylib 'd:\temp\prg1';*Call the proc sort and set output the sorted data , by descending Country and within each country descending Salary
*to temporary library , work.
proc sort data=mylib.sales
out=work.sales;by descending Country descending Salary;
run;
*print from the temp library , but only the Country Last_Name and Salary variables , or columns.
*Remember , columns are variables and rows are observations in SAS
proc print data=work.sales;var Country Last_Name Salary;
run;

*Set the library name and path. Note that this is a permanent library.
libname mylib 'd:\temp\prg1';
*Call the proc sort and set output the sorted data , by descending Country and within each country descending Salary
*to temporary library , work.
proc sort data=mylib.sales
out=work.sales;
by descending Country descending Salary;
run;
*print from the temp library , but only the Country Last_Name and Salary variables , or columns.
*Remember , columns are variables and rows are observations in SAS
proc print data=work.sales;
var Country Last_Name Salary;
run;