Hello,

I have reproduced a simple replica of a bigger problem.

I have data which looks as attached. I need, the value against HS 3201 as the sum of values against HS 32010, 32011, 32012, 32013 and similarly for HS 3202 to be the addition of values against 32021, 32022, 32023, 32024.

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(HS Value Desired)
 3201  .  10
32010  1  10
32011  2  10
32012  3  10
32013  4  10
 3202  . 110
32021 11 110
32022 22 110
32023 33 110
32024 44 110
end

Request your help for the relevant bysort / any other command to perform this.

Thanks in advance!