Hello!
I am running into a problem with a macro definition. When I run the sql code with a %let statement it works fine:
options macrogen mlogic symbolgen mprint mfile;
%let num=6;
proc sql ;
select "'"||trim(a.vkont)||"'"
into :nbr_&num. separated by ' '
from armdb2.ext_WO_list2 a
where group=&num.;
quit;
%put &nbr_6.
I'm intentionally omitting the noprint on the proc sql so that I can see what the macro resolves to on the output. The %put statement shows the contents of my macro just fine.
NOTE: Remote submit to SAS50 commencing.
223 %put &nbr_6.;
'000000335266' '000000335291' '000000335332' '000000335366'
'000000335460' '000000335484' '000000335516' '000000335522'
'000000375665' '000000375828' '000000375859' '000000375895'
NOTE: Remote submit to SAS50 complete.
Now I try to do the same thing but with a macro definition:
%macro javi(num);
proc sql ;
select "'"||trim(a.vkont)||"'"
into :nbr_&num. separated by ' '
from armdb2.ext_WO_list2 a
where group=&num.;
quit;
%mend javi;
%javi(num=7);
%put &nbr_7.;
Check out the log:
NOTE: Remote submit to SAS50 commencing.
204 %macro javi(num);
205 proc sql ;
206 select "'"||trim(a.vkont)||"'"
207 into :nbr_&num. separated by ' '
208 from armdb2.ext_WO_list2 a
209 where group=&num.;
210 quit;
211 %mend javi;
212
213 %javi(num=7);
NOTE: The PROCEDURE SQL printed pages 181-200.
NOTE: PROCEDURE SQL used (Total process time):
real time 0.06 seconds
cpu time 0.04 seconds
WARNING: Apparent symbolic reference NBR_7 not resolved.
214
215 %put &nbr_7.;
&nbr_7.
NOTE: Remote submit to SAS50 complete.
Am I going crazy here? What am I missing? And yes, there are values on the table for 7 as there were for 6. The even crazier thing is that on the output (because of the noprint) I can see the values of the macro coming out!
I would appreciate any help I can get. Thanks -Javi
I am running into a problem with a macro definition. When I run the sql code with a %let statement it works fine:
options macrogen mlogic symbolgen mprint mfile;
%let num=6;
proc sql ;
select "'"||trim(a.vkont)||"'"
into :nbr_&num. separated by ' '
from armdb2.ext_WO_list2 a
where group=&num.;
quit;
%put &nbr_6.
I'm intentionally omitting the noprint on the proc sql so that I can see what the macro resolves to on the output. The %put statement shows the contents of my macro just fine.
NOTE: Remote submit to SAS50 commencing.
223 %put &nbr_6.;
'000000335266' '000000335291' '000000335332' '000000335366'
'000000335460' '000000335484' '000000335516' '000000335522'
'000000375665' '000000375828' '000000375859' '000000375895'
NOTE: Remote submit to SAS50 complete.
Now I try to do the same thing but with a macro definition:
%macro javi(num);
proc sql ;
select "'"||trim(a.vkont)||"'"
into :nbr_&num. separated by ' '
from armdb2.ext_WO_list2 a
where group=&num.;
quit;
%mend javi;
%javi(num=7);
%put &nbr_7.;
Check out the log:
NOTE: Remote submit to SAS50 commencing.
204 %macro javi(num);
205 proc sql ;
206 select "'"||trim(a.vkont)||"'"
207 into :nbr_&num. separated by ' '
208 from armdb2.ext_WO_list2 a
209 where group=&num.;
210 quit;
211 %mend javi;
212
213 %javi(num=7);
NOTE: The PROCEDURE SQL printed pages 181-200.
NOTE: PROCEDURE SQL used (Total process time):
real time 0.06 seconds
cpu time 0.04 seconds
WARNING: Apparent symbolic reference NBR_7 not resolved.
214
215 %put &nbr_7.;
&nbr_7.
NOTE: Remote submit to SAS50 complete.
Am I going crazy here? What am I missing? And yes, there are values on the table for 7 as there were for 6. The even crazier thing is that on the output (because of the noprint) I can see the values of the macro coming out!
I would appreciate any help I can get. Thanks -Javi