I am trying to extract data from a data source given conditions from a staging table. The staging table has more than 1 record and I therefore have to select the appropriate data source between data sources.
filename EXECU1
TEMP;
%macro Raw_Data;
data _null_;
file EXECU1;
set CUSTOMER_FRAME33;
IF REPORT_NAME = 'ZUIKERBOSCH_DR' THEN DO;
put "proc sql; " / "create table " Data1 " as " / " select SAMPLE.SAMPLE_NUMBER, SAMPLE.PARENT_ALIQUOT, SAMPLE.SAMPLING_POINT, SAMPLE.ORIGINAL_SAMPLE,
SAMPLE.SAMPLED_DATE, RESULT.NAME, RESULT.FORMATTED_ENTRY,RESULT.UNITS,
RESULT.NUMERIC_ENTRY, RESULT.STATUS,RESULT.REPORTABLE, RESULT_NUMBER";
put " from datasource1.sample, VGSQL1.datasource1" / " where sample.sample_number=result.sample_number and" / " sample.sampled_date between ";
put "'" start_date +(-1) "'d and" ;
put "'" end_date "'d";
put "and sample.sampling_point in " SAMPLING_POINTS" and " / " RESULT.name in " DETERMINANDS" and " ;
put "result.status = 'A' and " / " result.reportable = 'T' and " / " parent_aliquot ne 0;" ;
;END;ELSE
IF REPORT_NAME = 'ZUIKERBOSCH_RD' THEN DO;
put "proc sql; " / "create table " Data1 " as " / " select SAMPLE.SAMPLE_NUMBER, SAMPLE.PARENT_ALIQUOT, SAMPLE.SAMPLING_POINT, SAMPLE.ORIGINAL_SAMPLE,
SAMPLE.SAMPLED_DATE, RESULT.NAME, RESULT.FORMATTED_ENTRY,RESULT.UNITS,
RESULT.NUMERIC_ENTRY, RESULT.STATUS,RESULT.REPORTABLE, RESULT_NUMBER";
put " from datasource2.sample, datasource2.result" / " where sample.sample_number=result.sample_number and" / " sample.sampled_date between ";
put "'" start_date +(-1) "'d and" ;
put "'" end_date "'d";
put "and sample.sampling_point in " SAMPLING_POINTS" and " / " RESULT.name in " DETERMINANDS" and " ;
put "result.status = 'A' and " / " result.reportable = 'T' and " / " parent_aliquot ne 0;" ;
;END;
%include EXECU1;
%mend Raw_Data;
%Raw_Data;
I get two errors as follows:
ERROR: Cannot open %INCLUDE file EXECU1.
;*';*";*/;quit;run; ____ 180
ERROR 180-322: Statement is not valid or it is used out of proper order.
Please help
... View more