Hi All,
Im trying to use a macro passed parameter in Proc SQL Case as below. Something is wrong in this as the output is not as expected.
Request someone to guide me if i can use this approach?
%macro InsertTable(pSourceTable=, pLoadMethod=, pDataTransferID=); proc sql; insert into <TableName> ( Column1, Column2, Column3, Column4 ) select Column1, Column2, case &LoadMethod. when 'D' then Column3 when 'F' then &pDataTransferID. end as Column3,
case &LoadMethod. when 'D' then Column4 when 'F' then 'I' end as Column4 from &pSourceTable.; quit; %mend InsertTable;
%InsertTable(pSourceTable=SourceTable, pLoadMethod='D', pDataTransferID=1); %InsertTable(pSourceTable=SourceTable, pLoadMethod='F', pDataTransferID=1);
... View more