Sort the response and the feature tables in the order of the BY variable. By default, the first PROC SORT sorts the response data set created in the code above. Both sorted data sets are stored in the SAS temporary library WORK. To enable the data sets to be merged, the same BY variable is used to sort both the response and feature tables.


proc sort data=sites out=sites;
   by state;
run;

proc sort data=maps.us2 out=mymap;
   by state;
run;