# Collapsing variables

**URL:** <https://forum.ipums.org/t/collapsing-variables/4214>\
**Category:** USA\
**Created:** [July 3, 2021, 5:06pm UTC](https://forum.ipums.org/t/collapsing-variables/4214 "2021-07-03T17:06:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chip\_Halbach](https://avatars.discourse-cdn.com/v4/letter/c/b487fb/32.png) [@Chip\_Halbach](https://forum.ipums.org/u/Chip_Halbach)\
**Post date:** [July 3, 2021, 5:06pm UTC](https://forum.ipums.org/t/collapsing-variables/4214/1 "2021-07-03T17:06:12Z")

</div>

I’m trying to get the number of households in a PUMA by income summed in $5,000 segments (0-5000, 5001-10000, etc) by using hhincome(c: 5000,0) for rows. And when run the table I get the error message that the number of rows exceeds the allowed max of 250. I know there are not 250 rows of 5000 increment, I even filtered for hhincome \< $300,000 and no luck. What can I do to get the these sums? [Adding that when I set the increment to $50,000 – hhincome(c:50000,0) – it works just fine and I get the numbers of households summed into about 6 rows.]

---

<div class="post-metadata">

**Author:** ![KariWilliams](https://avatars.discourse-cdn.com/v4/letter/k/82dd89/32.png) [@KariWilliams](https://forum.ipums.org/u/KariWilliams)\
**Post date:** [July 8, 2021, 9:51pm UTC](https://forum.ipums.org/t/collapsing-variables/4214/2 "2021-07-08T21:51:46Z")

</div>

This appears to be a function of the online analysis tool assuming that the variable includes all values between the minimum (-$19,998) and the N/A value of 9999999, rather than recognizing that there is a large gap between the top-codes and the N/A code. I suspect that the system makes the assessment about how many rows would result before reviewing the selection filters that would limit your output, but am not certain. I will ask my colleagues who know more about the behind the scenes aspects of the SDA tool if they have any insight on this.

In the meantime, the best solution I have for this is to use the recode option rather than collapse (see below); I appreciate that this is comparatively quite cumbersome. Unfortunately, the values assigned to the N/A and NIU codes differ by variable, so I don’t think there is a way to systematically exclude them.  
`hhincome(r: 0-4999; 5000-9999; 10000-14999; 15000-19999, etc.)`

---

<div class="post-metadata">

**Author:** ![Chip\_Halbach](https://avatars.discourse-cdn.com/v4/letter/c/b487fb/32.png) [@Chip\_Halbach](https://forum.ipums.org/u/Chip_Halbach)\
**Post date:** [July 9, 2021, 7:45pm UTC](https://forum.ipums.org/t/collapsing-variables/4214/3 "2021-07-09T19:45:00Z")

</div>

Thank you very much for your response, Kari. I have tried the recode alternative… but that gets pretty tedious when I want to separate incomes between 0 and $1,000,000 in $5,000 segments. Hope at some point there will be a way to make collapse work.
