@Samiresh wrote:
I have a dataset "tablenames" with the list of table names and the row count for each table. I need to run an iteration loop for SYMPUT function such that each row values is parsed to 2 global variables. These 2 global variables containing the value of the table name and row count is used in another macro program.
I am not able to pass multiple iterations of values to SYMPUT function as it takes only the final row data. Try many work arounds but all ended up with errors. Please find the below structure of code i am using
Here in the below code, i tried to copy table contents into 2 individual global arrays and tried to use them in the do - while loop. But the code didn't execute successfully
Code
proc sql;
select filename into :file_name from function_call order by row_num;
run;
proc sql;
select record_count into :record_count from function_call order by row_num;
run;
%do i=1 %to &max_size. %by 1;
call symput('scenario_us',trim(scenarios[&i]));
%put ETL-NOTE: scenario_us = &scenario_us;
run;
%end;
Call symput is usually in a data step though I guess you might use it in a Proc SQL Call. However, your call symput is in neither. The use of
scenarios[&i]
requires an array, which means it belongs in a data step and you very clearly do not have a data step or an array definition.
Just how many errors do you get in the log with this attempted code?
If you provide a small example data set and what the actual content of your macro variables is supposed to be we may be able to help with that. But sticking multiple values into a single variable almost always is followed by pulling them out again.
Note that the result of this code
proc sql;
select filename into :file_name from function_call order by row_num;
quit;
is going to place the first, by alphabet value within row_num, filename. ONE filename only. So I am not sure what relation this has to placing multiple values into anything since you do not use the created $filename macro variable.