Hours Worked Pseudocode

Those who are employed are asked to give an estimate of the number of hours they work. This measurement takes two forms in the CPS: actual and usual hours worked. The below pseudocode provides an outline of how to calculate average hours worked at a monthly frequency for a given population using variables from the 2015 format of these variables. In this case, the population will be all employed individuals, but additional filters on the population can be applied to obtain the same calculation for a different sub-group.

Note: PEHRUSL1, PEHRUSL2, and PEHRUSLT have a value of -4 for some individuals that indicates “Hours Vary”. If you are looking for average hours worked for a population, this value does not provide a number, so we exclude it.


If PEMLR is 1 or 2 and PEHRUSLT>0

Average usual hours worked = total(PWSSWGT * PEHRUSLT)/sum(PWSSWGT) by HRMONTH and HRYEAR4

If PEMLR is 1 or 2 and PEHRACTT>0

Average actual hours worked=total(PWSSWGT * PEHRACTT)/sum(PWSSWGT) by HRMONTH and HRYEAR4