10-14-2015 04:04 PM - edited 10-14-2015 04:04 PM
I have created a list of macro variables in a PROC SQL without error. When I create the macro variables I have a list of parameters (costval) that I have created previosuly in the job. I cannot hard code these values because they may change and I want the flexibility to pick up any new ones that are added. I am having trouble getting the syntax right to get these values to resolve in a DATA step further down the line. How do I get these costvals to resolve? Any help would be appreciated.
proc sql noprint ;
select %do i = 1 %to &costvars ;
%do i = 1 %to &costvars ;
from work.emptycc ;
10-14-2015 04:26 PM
You might find it easier if you change the names of the macro variables that SQL creates.
You would still have &costval1 - &costvalN that tells you how the numbers relate to the original field names.
10-14-2015 04:28 PM
Hard to tell what may be going on. Have you tried using options mprint or adding a %put _user_; statement after the proc sql to see what your code is resolving to?
Are you getting any errors? If so what are they?