Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# Re: st: basic question

 From David Kantor To statalist@hsphsun2.harvard.edu Subject Re: st: basic question Date Mon, 22 Aug 2011 22:32:35 -0400

```At 09:24 PM 8/22/2011, you wrote:
```
```[...]

My variables meas:

v9532: income from main job
v9982: income from secondary job
v1022: third or more of income jobs

But most of the people have only one job, so they get missing to v9982
and v1022...
```
```
```
In that case, the missing values ought to be recoded to 0. Thus, if I don't have a second job, then the income from my second job is 0 -- not missing. Similarly for the third.
```
But you may need to be more cautious. Do these variables have either...
1, a special value that signifies "unknown", or
```
2, an additional variable that tells you that the value for v9982 is unknown? (Similarly for v1022.) If so, then you need to code the income variables to reflect these conditions -- to distinguish "no second job" from "has a second job, but income is unknown". The former should correspond to 0; the latter to missing, in which case the expression v9532 + v9902 + v1022 will (correctly) yield missing.
```
```
Other respondents mentioned egen... rowtotal, which will treat missings as zero. This will work with the values as given, but it may be best to code your values as I have indicated -- 0 rather than missing, where appropriate -- and use +. Note that, given the proper coding of the variables, egen...rowtotal will give you something else: the sum of known values.
```
HTH
--David
P.S., as a minor point, I suspect that you mean v10022 where you wrote v1022.

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```