passing a variable value from a macro to a snippet

I need to assign the same value to li and its nested ul to map them. The li is generated in the macro, node_slot_max, and ul is generated in the snippet template, mgsSnMegaDdBubble, associated with the macro. The value is dynamically generated and assigned to the variable, $subcat-id, in the macro. So, the output looks like this:

<li parent-id=”1”>…<ul child-id=”1”>…</ul></li>   
<li parent-id=”2”>…<ul child-id=”2”> …</ul></li>      
<li parent-id=”3”>…<ul child-id=”3”> …</ul></li>

#node_slot_max takes a slot as a parameter, which is mgsSlotMegaLavel1.

#node_slot_max($node "mgsSlotMegaLabel1" "" "<li>" "</li>" "" "" 6)
#macro(node_slot_max $node $slotname $header $before $after $footer $params $max)
#set($numSlotItems=0)##
#__slotsetup($slotname $params)##
#set($cloneditem = $sys.assemblyItem.clone())##
$cloneditem.setNode($node)##
#set($sys.currentslot.relresults = $rx.asmhelper.assemble($cloneditem,$sys.currentslot.slot,$completeparams))##
#set($numSlotItems=$sys.currentslot.relresults.size())##
#if($sys.currentslot.relresults.size() > 0)##
    $header##
    #set($subcat-id = 1)##
    #foreach( $relresult in $sys.currentslot.relresults )##
		#set($matched_value = $sys.assemblyItem.bindings.put('$parent-id', $subcat-id))##
        #if($velocityCount le $max || ($sys.ltActiveAssembly || $sys.activeAssembly))##
            <li class="category-drop-li" data-subcat-label="$subcat-id">##$before##		
			#set($body = "$rx.doc.extractBody($relresult)")##
			$body##		
			</li>##$after##
        #end## if
        #set($subcat-id = $tools.math.add($subcat-id,1))##
    #end## foreach
    $footer##
#end##
#end##

In the macro, #foreach() is used to generate a unique id to each item which li in the slot, mgsSlotMegaLabel1 instead of using the built-in slot macro. I need to pass the value to its associated snippet, mgsSnMegaDdBubble, to assign it to the li’s nested ul for a jQuery plugin.

Snippet, mgsSnMegaDdbubble:

<a class="nav_bubblelabel"  href="$pagelink">#contextTitleField()</a>
#slotListSetup("mgsSlotMegaDdBubbleUp" "")##
#if($numSlotItems > -1)##
	#set($slotname="mgsSlotMegaDdBubbleUp")##
#else##
	#slotListSetup("mgsSlotCategoryMainContent" "")##
	#set($slotname="mgsSlotCategoryMainContent")##
#end##
#if($numSlotItems > 0)##
	<ul class="subcat" data-label="$parent-id">	
		<li class="subcat-heading" aria-hidden="true"><a class="nav_bubblelabel"  lang="$lang" href="$pagelink">#displayfield("g_title")</a></li>
	#define($filtercode)##
		#set($sniplink = $relresult.getBindings().get("\$pagelink") )##
		#if ($!{sniplink} == "")true#end##
#end##
	</ul><!-- .subcat -->

I tried:

#set($matched_value = $sys.assemblyItem.bindings.put('$parent-id', $subcat-id))

This was set in the macro.
$subcat-id is uniquely generated and added to <li> in #foreach.
$subcat-id and $sys.assemblyItem.bindings.put(’$parent-id’, $subcat-id) show the same value within the #foreach( $relresult in $sys.currentslot.relresults ). The value doesn’t show up in the snippet, instead the variable, $parent-id, is printed.

The value doesn’t get passed to the snippet. The macro is in the user macro file. Is it something to do with not passing on the value? Or, is there any better way to accomplish this?