04-08-2013 10:12 AM
Can anybody offer any solutions to fix the below. I can do it myself by putting the majority of the code inside a macro and calling the macro, but would like to know if there is a non macro way to do it.
Do DS_Val = 1 To 10;
Ret_Val = %Macro( Lib.Cluster ( MemNum = DS_Val ) );
DS_Val = 99;
Set Lib.Cluster ( MemNum = DS_Val );
Hopefully from the highlights, it's obvious what I'm trying to do, but just in case. I'm trying to pass a dataset value (DS_Val) to either an option within a set statement or an option within a macro ran within a datastep.
04-08-2013 11:13 AM
Well, it's not clear what you really want to do (or why)?
I'm guessing that you want to read certain members from a SPDS libname, right?
I don't know how you want to supply the numbers, do you want to store several menum in the same captured_data table?
And why do you want to extract data based on memnum at all?
04-08-2013 11:16 AM
I cannot figure out what purpose the sample code could serve, but if you want to make a piece of code a variable you do not need to create a macro, just assign the value to a macro variable and reference it where it is needed.
%let varname=ds_val ;
do &varname = 1 to 10;
ret_val = resolve(cats('%mymac( lib.cluster ( memnum =',&varname,'))'));
&varname = 99;
set lib.cluster ( memnum = &varname );