I created a macro using SAS version 9.4 to read data from DTAQ zip dataset. the code looks like the following (it is reading data from DTAQ trade file one day at a time):
libname rasheek "D:\Rasheek I\";
*** Loop for processing DTAQ_2.1 data;
%macro ZipRead_vars(rawzip,rawfile,outdata,outdata1, ddt,round,macrofile);
%do rd=1 %to &round;
%global zipfile mb outdt outdt1 datadate;
%let zipfile=%scan(&rawzip,&rd,'*');
%let mb=%scan(&rawfile,&rd,'*');
%let datadate=%scan(&ddt,&rd,'*');
%let outdt=%scan(&outdata,&rd,'*');
%let outdt1=%scan(&outdata1,&rd,'*');
%scan(¯ofile,1,'#');
%end;
%mend ZipRead_vars;
%ZipRead_vars(D:\DTAQ_RAW\2014\201401\Trd\EQY_US_ALL_TRADE_20140102.zip*
D:\DTAQ_RAW\2014\201401\Trd\EQY_US_ALL_TRADE_20140103.zip*,
taqtrade20140102*taqtrade20140103*,
rasheek.trd_20140102*rasheek.trd_20140103*,
rasheek.trd_20140102_1*rasheek.trd_20140103_1*,
20140102*20140103*,2,%TRD_Read21;#);
%macro TRD_Read21;
filename trd zip "&zipfile" member="&mb";
Data &outdt;
Infile trd firstobs=2 missover;
input
@1 hh 2.
@3 mm 2.
@5 ss 2.
@7 ss1 3.
@1 time 9.
@10 Exchange $1.
@11 Symbol $16.
@27 SaleCondition $4.
@31 TradeVolume 9.
@40 TradePrice 11.4
date=&datadate;
ticker=compress(symbol);
stime=hh*3600+mm*60+ss+0.001*ss1;
DollarVolume=TradeVolume*TradePrice;
if stime<34200 or stime>57600 then delete;
run;
proc sql;
create table &outdt1 as
select date, symbol,SaleCondition, sum(tradevolume)as totaltradevolume, sum(dollarvolume)as totaldollarvolume
from &outdt
group by date, symbol, SaleCondition
;
quit;
%mend TRD_Read21;
When I run the code I get error: more positional parameters found than defined. However, if I change the last part of the code to the following it works.
create table &outdt1 as
select * from &outdt
;
quit;
%mend TRD_Read21;
please help/guide me in fixing the code. Thank you in advance