Hello,
I'm interested in creating a do loop while a macro variable shows there is a error grater than 0.
I'm setting the macro variable as the result of a proc sql query.
here what my code look like:
%Macro MacroSample(RL=)
%let TableName1 = "1&RL. Table1Name"n;
%let TableName2 = "2&RL. Table2Name"n;
PROC SQL;
CREATE TABLE WORK.&tablename2. AS
SELECT
(SUM(t1.'Connection Difference'n)) AS 'Connection Difference'n
Into : CheckFlag
FROM WORK.&tablename1. t1;
Where t1.Field1 = &RL.;
%Let CheckFlag = &CheckFlag;
QUIT;
/* Macro Begins if Connection Mismaches Fails */
%Do %while (&CheckFlag. >0);
/* Begin loop by updating the original table until sum of error is 0*/
PROC SQL;
CREATE TABLE WORK.&tablename1. AS
SELECT
Libref1.Field1,
Libref1.Field2
Calculation1 AS 'Connection Difference'n
FROM WORK.&TableName1. t1;
QUIT;
CREATE TABLE WORK.&tablename2. AS
SELECT
(SUM(t1.'Connection Difference'n)) AS 'Connection Difference'n
Into : CheckFlag
FROM WORK.&tablename1. t1;
%Let CheckFlag = &CheckFlag;
%End
%Mend MacroSample;
%MacroSample(RL= "Low")