Help using Base SAS procedures

Problem with match merging 2 datasets

Reply
N/A
Posts: 1

Problem with match merging 2 datasets

CODE:

Data New;

  merge WORK.COMBINED _EXP2_.TRADES_22FEB2010;

  by symbol time;

Run;

ISSUE: want to merge two data sets so that there are unique entries for each time by symbol, such that at each "TIME" there is a row in each data set with 120 unique "SYMBOL".

ERROR: BY variables are not properly sorted on data set WORK.COMBINED.

time=57599970 symbol=MELI best_hft_bid=40.78 best_nonhft_bid=40.91 best_hft_ask=41.04

best_nonhft_ask=40.93 hft_bsize=1200 hft_asize=3100 nonhft_bsize=100 nonhft_asize=2839 date=22FEB2010

shares=50 buysell=B price=36.8300 type=NN FIRST.symbol=0 LAST.symbol=0 _ERROR_=1 _N_=505346

NOTE: MERGE statement has more than one data set with repeats of BY values.

NOTE: The SAS System stopped processing this step because of errors.

NOTE: There were 29127 observations read from the data set WORK.COMBINED.

NOTE: There were 480364 observations read from the data set _EXP2_.TRADES_22FEB2010.

WARNING: The data set WORK.NEW may be incomplete.  When this step was stopped there were 505345

         observations and 15 variables.

WARNING: Data set WORK.NEW was not replaced because this step was stopped.

Trusted Advisor
Posts: 1,228

Re: Problem with match merging 2 datasets

Before merge both data sets should be sorted by symbol time. Sort WORK.COMBINED before merging.

proc sort data=WORK.COMBINED;

by symbol time;

run;

Super User
Posts: 19,862

Re: Problem with match merging 2 datasets

Sort each dataset before merge as the error indicates.

Or switch to a proc sql.

Ask a Question
Discussion stats
  • 2 replies
  • 145 views
  • 0 likes
  • 3 in conversation