Hi all, I am trying to take the result of a macro variable which itself is the name of a macro variable and get that to resolve to its value. The macro /*Macro variable SegmentA will already have the value 100 */ %let SegmentA= 100; /*I pull the Segment values I need from a dataset and use the SQL INTO to get a macro variable with the value of the segment*/ %let seg1= SegmentA; %put &&seg1;/*this doesn't work*/ /*How do I get the value of seg1 (SegmentA) to resolve to its macro value (100)?*/ /*If you know how to get Seg1 to return 100, you don't need to look further below*/ /*Actual Code*/ /*Here is more of the code so you can maybe see why I am trying to do this*/ /*The macros with the 'numeric' values have already been established upstream*/ /*The point of this is that I have a specific # of records I need to pull from each segmentation. That number of records per segmentation is stored in a macro variable of the same name as the segmentation*/ %macro Test; %local i; Proc SQL; select distinct segmentation from p.seg where segmentation ne ' ' order by segmentation; select distinct segmentation into :s1 - :s&sqlobs. from p.seg where segmentation ne ' ' order by segmentation; quit; %do i=1 %to &sqlobs; %put run# &i. of &sqlobs. for macro_container=&&s&i.; %let mc= &&s&i; /*Set ts=1 if the record is under the threshold for that segmentation*/ data temp; set p.seg; if _n_ <= &mc. then ts=1; /*Also need to determine how to get this to resolve as an integer. Input(&mc.,8.) didn't work*/ where segmentation=%unquote(%nrquote(%'&mc.%')); /*Limit to just 1 segmentation at a time*/ run; /*Update the segmentation to segmentationvalue_overlimit if ts=0 from Temp because those are the records in the segmentation over the # limit I need*/ proc sql; update p.seg as a set segmentation=( select cats(segmentation,'_overlimit') from temp b where a.acc_id=b.acc_id and ts=0 ) ;quit; %end; %mend; %Test;
... View more