02-13-2015 10:40 AM
In this case, &num was created by SQL to count the number of obs in data(have).
Instead using &num directly to create array, I have to assign the &num value to &end to make it work. Why?
The log screen was attached.
input year_mth @@;
201412 201411 201410
select count (distinct year_mth) into:num
%put check the new macro value: #
/*Why not working if use &num directly*/
array L (*) L01-L#
do i=01 to #
/*It works when converting by let statement*/
%let end = #
array L (*) L01-L&end;
do i=01 to &end;
02-13-2015 10:50 AM
Because the macro variable has leading spaces so what the compiler sees is:
Use the Trimmed option in your SQL to remove the spaces:
Into :num Trimmed
Need further help from the community? Please ask a new question.