Hi Cynthia, Thanks for looking at this log! I don't know how you got it to run with different tables. **************************************************; * Step 1: Create Macro Variables *; **************************************************; %let Division=3; proc sql noprint; select quote(strip(Name)) into :StateList SEPARATED BY "," from sq.statepopulation where Division = "&Division"; quit; %put &=Division; %put &=StateList; **************************************************; * Step 2: Use Macro Variables *; **************************************************; options symbolgen; proc sql; create table division&Division as select * from sq.customer where State in (&StateList); quit; options nosymbolgen; LOG Step 1 %let Division=3; 74 75 proc sql noprint; 76 select quote(strip(Name)) 77 into :StateList SEPARATED BY "," 78 from sq.statepopulation 79 where Division = "&Division"; NOTE: Data file SQ.STATEPOPULATION.DATA is in a format that is native to another host, or the file encoding does not match the session encoding. Cross Environment Data Access will be used, which might require additional CPU resources and might reduce performance. 80 quit; NOTE: PROCEDURE SQL used (Total process time): real time 0.01 seconds cpu time 0.00 seconds 81 %put &=Division; DIVISION=3 82 %put &=StateList; STATELIST="IL","IN","MI","OH","WI" 83 84 85 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 97 LOG Step 2 78 where State in (&StateList); SYMBOLGEN: Macro variable STATELIST resolves to "IL","IN","MI","OH","WI" NOTE: Data file SQ.CUSTOMER.DATA is in a format that is native to another host, or the file encoding does not match the session encoding. Cross Environment Data Access will be used, which might require additional CPU resources and might reduce performance. ERROR: Some character data was lost during transcoding in the dataset SQ.CUSTOMER. Either the data contains characters that are not representable in the new encoding or truncation occurred during transcoding. NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements. 79 quit; NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE SQL used (Total process time): real time 0.12 seconds cpu time 0.11 seconds 80 options nosymbolgen; 81 82 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 94
... View more