This SQL sums all the population in US sucatchments of selected nodes and store it in the user_number_1. Set the object type as "All Nodes" and use the following code:

LIST $nodeID STRING;
SELECT SELECTED DISTINCT node_id INTO $nodeID FROM [All Nodes];


LET $i=1;
WHILE $i<=LEN($nodeID);
DESELECT ALL FROM [All Nodes];
SELECT FROM [All Nodes] WHERE node_id= AREF($i,$nodeID);

UPDATE [ALL Links] SET $link_selected = 0;
UPDATE [ALL Nodes] SET $node_selected = 0;
UPDATE SELECTED SET $node_selected = 1;


LET $count = 0;
WHILE $count < 100;


SET us_links.$link_selected = 1 WHERE $node_selected = 1;
UPDATE [ALL Links] SET us_node.$node_selected = 1 WHERE $link_selected = 1;
LET $count = $count + 1;
WEND;


SELECT FROM [All Nodes] WHERE $node_selected = 1;


UPDATE Subcatchment SET $subcatchment_selected =0;
UPDATE SELECTED SET subcatchments.$subcatchment_selected =1;


DESELECT ALL From Subcatchment;


SELECT FROM Subcatchment WHERE $subcatchment_selected =1;
SELECT SELECTED Sum(population) INTO $summ FROM Subcatchment;

SELECT FROM [All Nodes] WHERE node_id= AREF($i,$nodeID);
UPDATE SELECTED SET user_number_1=$summ;


LET $i=$i+1;
WEND;


DESELECT ALL FROM [All Nodes];
DESELECT ALL From Subcatchment;