# \[AMPL 24705\] Display Variables

**URL:** <https://discuss.ampl.com/t/ampl-24705-display-variables/627>\
**Category:** Google Group Mirror\
**Created:** [June 28, 2023, 4:14pm UTC](https://discuss.ampl.com/t/ampl-24705-display-variables/627 "2023-06-28T16:14:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andres\_Porto](https://avatars.discourse-cdn.com/v4/letter/a/71e660/32.png) [@Andres\_Porto](https://discuss.ampl.com/u/Andres_Porto)\
**Post date:** [June 28, 2023, 4:14pm UTC](https://discuss.ampl.com/t/ampl-24705-display-variables/627/1 "2023-06-28T16:14:43Z")

</div>

Hello everyone, I hope you are well.

I wanted to ask you for help with something. When using display and seeing the values of a variable, is it possible to ask it for each of the indices of a certain set to add the values of the other indices in the other sets? How could I do it

Example

Z:  
1 2:=  
1 1 3  
2 2 3  
3 4 2

Z[_,1]= 7  
Z[_,2]= 8

Thank you.

I usually do sum{i in SET1, j in SET2}Z[i,j], however, this time, I need partial sums of the variable Z.

Greetings,

---

<div class="post-metadata">

**Author:** ![AMPL\_Google\_Group](https://avatars.discourse-cdn.com/v4/letter/a/9dc877/32.png) [@AMPL\_Google\_Group](https://discuss.ampl.com/u/AMPL_Google_Group)\
**Post date:** [June 29, 2023, 9:00pm UTC](https://discuss.ampl.com/t/ampl-24705-display-variables/627/2 "2023-06-29T21:00:46Z")

</div>

You can display the sums with this command:

`display {j in SET2} sum {i in SET1} Z[i,j];`

The output will look like this:

`sum{i in SET1} Z[i,j] [*] :=`  
`1 7`  
`2 8 ;`
