04-12-2012 06:48 PM
I'm having trouble with merging two data sets - one is a large file, bcarrier_line, with over 22 million rows. The other file is a DESY_SORT_KEY file with 344 rows (one column). I wish to merge the two files by DESY_SORT_KEY, so bcarrier_line file only outputs rows with desired DESY_SORT_KEY values.
I've ran this code with no errors, but the log output shows no row number change upon the merge (i.e. the larger file doesn't decrease in row size). From similar, but other, files I know the merge should significantly decrease the number of rows of the bcarrier_line data set.
libname aaa 'M:\';
%let bcarrier = bcarrier_line;
*Already a SAS dataset;
PROC SORT data = aaa.&bcarrier;
PROC SORT data=desy;
PROC EXPORT DATA = mergeaaa
Any tips or advice is most appreciated!
04-12-2012 07:31 PM
Use SQL instead for a one step process.
Create table mergeaaa as
select * from aaa.bcarrier
where DESY_SORT_KEY in (select DESY_SORT_KEY from desy);
OR try the in option in your merge:
merge aaa.&bcarrier (in=a)