@ballardw Thank you for these details. Okay so, this is the actual code I'm using (I had mocked up that example to try and make it simpler) as well as the log. What I'm running into I think is on that where filter as well as the create table, it puts in the whole list of strings. Code: %macro client_loop();
proc sql;
select distinct clnt_cd into :clients separated by ' ' from com.triessent_fee_schedule;
quit;
%do i=1 %to %sysfunc(countw(&clients));
%let my_client=%scan(&clients,&i,%str());
proc sql;
create table &my_client as
select distinct
t1.ndc_num as ndc,
t1.exclrate as exclusive_rate format=percent9.4,
lmtddistr as ldd_flag,
(0) as quality_network_rate,
(0) as non_exclusive_rate
from com.specialty_fee_schedule t1
where t1.clnt_cd = "&my_client" and t1.exclrate > 0 and fee_schedule_dml_based_flag="YES";
quit;
%end;
%mend;
options mprint;
%client_loop(); You'll notice that I put &my_client in the create table. The values in the client list are things like: BCBSMN, BCBSIL, BCBSFL...they are not too long for a table name and there are 22 of them. Here is what I'm running into in the log from running the above code: NOTE: Implicit SQL: select distinct TXT_1.Clnt_CD from TRIESSENT_FEE_SCHEDULE TXT_1
WARNING: No output destinations active.
MPRINT(CLIENT_LOOP): quit;
NOTE: PROCEDURE SQL used (Total process time):
2 The SAS System 11:15 Thursday, October 8, 2020
real time 4.08 seconds
user cpu time 0.01 seconds
system cpu time 0.00 seconds
memory 5261.00k
OS Memory 20900.00k
Timestamp 10/08/2020 11:16:06 AM
Step Count 2 Switch Count 58
Page Faults 1
Page Reclaims 204
Page Swaps 0
Voluntary Context Switches 201
Involuntary Context Switches 2
Block Input Operations 0
Block Output Operations 0
MPRINT(CLIENT_LOOP): proc sql;
NOTE: Line generated by the macro variable "MY_CLIENT".
37 BCBSA BCBSAL BCBSFL BCBSIL BCBSKS BCBSMN BCBSMT BCBSNC BCBSND BCBSNE BCBSNJ BCBSNM BCBSOK BCBSRI BCBSTX BCBSTX09 BCBSWY
______
22
76
37 ! BOEING CBC CHP PRIME REGENCE
MPRINT(CLIENT_LOOP): create table BCBSA BCBSAL BCBSFL BCBSIL BCBSKS BCBSMN BCBSMT BCBSNC BCBSND BCBSNE BCBSNJ BCBSNM BCBSOK
BCBSRI BCBSTX BCBSTX09 BCBSWY BOEING CBC CHP PRIME REGENCE as select distinct t1.ndc_num as ndc, t1.exclrate as exclusive_rate
format=percent9.4, lmtddistr as ldd_flag, (0) as quality_network_rate, (0) as non_exclusive_rate from com.specialty_fee_schedule t1
where t1.clnt_cd = "BCBSA BCBSAL BCBSFL BCBSIL BCBSKS BCBSMN BCBSMT BCBSNC BCBSND BCBSNE BCBSNJ BCBSNM BCBSOK BCBSRI BCBSTX
BCBSTX09 BCBSWY BOEING CBC CHP PRIME REGENCE" and t1.exclrate > 0 and fee_schedule_dml_based_flag="YES";
ERROR 22-322: Syntax error, expecting one of the following: (, '.', AS, LIKE.
ERROR 76-322: Syntax error, statement will be ignored.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
MPRINT(CLIENT_LOOP): quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 46.71k
OS Memory 16288.00k
Timestamp 10/08/2020 11:16:07 AM
Step Count 3 Switch Count 52
Page Faults 1
Page Reclaims 12
Page Swaps 0
Voluntary Context Switches 154
Involuntary Context Switches 2
Block Input Operations 0
Block Output Operations 0
... View more