Data Cart

Your data extract

0 variables
0 samples
View Cart
SUBFNUM
Subfamily membership number

Codes and Frequencies



Loading Frequency Data...

Can't find the category you are looking for? Try the Detailed codes

Explore how IPUMS created this variable

Download


      class Subfnum : public Editor {

public:
  Subfnum(VarPointer varInfo) : Editor(varInfo) {}
  void edit() {

    int64_t a = 1;
    if (GQ() == 20) {
      a = 0;
    }
    switch (dataSet) {
    case dataset_id::hu1970a:
    case dataset_id::hu1980a:
    case dataset_id::hu1990a:
    case dataset_id::hu2001a:
    case dataset_id::es2001a:
    case dataset_id::gr2001a:
    case dataset_id::sn1988a:
    case dataset_id::br1970a:
    case dataset_id::br1960a:
    case dataset_id::de1981a:
    case dataset_id::ie1981a:
    case dataset_id::ie1986a:
    case dataset_id::ie1991a:
    case dataset_id::ie2002a:
    case dataset_id::ie2006a:
    case dataset_id::ie2016a:
    case dataset_id::gr2011a:
    case dataset_id::hu2011a:
    case dataset_id::pl1978a:
    case dataset_id::pl1988a:
    case dataset_id::pl2002a:
    case dataset_id::pl2011a:
    case dataset_id::fj2007a:
    case dataset_id::zm2000a:
    case dataset_id::se1890a:
    case dataset_id::se1900a:
    case dataset_id::se1880a:
    case dataset_id::is1729a:
    case dataset_id::is1901a:
    case dataset_id::is1910a:
    case dataset_id::bj2002a:
    case dataset_id::bj2013a:
    case dataset_id::us2010a:
    case dataset_id::us2015a:
    case dataset_id::us2020a:
    case dataset_id::pr2010a:
    case dataset_id::pr2015a:
    case dataset_id::pr2020a:
    case dataset_id::tg1970a: {
      a = SUBFNUM.getRecoded();
    } break;
    case dataset_id::is1703a: {

      long fcount = 1;
      long sfnum;

      for (long i = 1; i <= countPeople(); i++) {
        sfnum = SUBFNUM.getRecoded(i);
        if (sfnum > 1) {
          if (isHead(i)) {
            fcount++;
            sfnum = fcount;
          }
        }
        setData(i, sfnum);
        if (PERNUM() == i)
          a = sfnum;

      } // each person i
    } break;
    case dataset_id::uk1851c:
    case dataset_id::uk1911a:
    case dataset_id::uk1851a:
    case dataset_id::uk1851b:
    case dataset_id::uk1861a:
    case dataset_id::uk1861b:
    case dataset_id::uk1871b:
    case dataset_id::uk1881a:
    case dataset_id::uk1881b:
    case dataset_id::uk1891a:
    case dataset_id::uk1891b:
    case dataset_id::uk1901a:
    case dataset_id::uk1901b: {

      if (isMultiHead()) {

        long fcount = 0;
        long sfnum = 0;
        for (long p = 1; p <= countPeople(); p++) {
          if (isHead(p)) {
            fcount++;
            sfnum = fcount;
          }
          setData(p, sfnum);
          if (p == PERNUM())
            a = sfnum;
        }

      } else { // not multi head
        a = SUBFNUM.getRecoded();
      }
    } break;
    case dataset_id::br1980a: {
      a = 1;
      /*
if (value(ln, 10, 10) == 2)                a = 2;
if (value(ln, 10, 10) == 3)
a = 3;
      */
      if (BR1980A_0405() == 2)
        a = 2;
      if (BR1980A_0405() == 3)
        a = 3;
    } break;
    case dataset_id::br1991a: {
      a = 1;
      /*
if (value(ln, 21, 21) == 4)
a = 2;
if (value(ln, 21, 21) == 5)
a = 3;
if (value(ln, 21, 21) == 6)
a = 4;
if (value(ln, 21, 21) == 7)
a = 5;

*/
      if (BR1991A_0403() == 4)
        a = 2;
      if (BR1991A_0403() == 5)
        a = 3;
      if (BR1991A_0403() == 6)
        a = 4;
      if (BR1991A_0403() == 7)
        a = 5;
    } break;
    case dataset_id::br2000a: {
      a = SUBFNUM.getRecoded();

      /*
if (value(ln, 78, 78) == 0)
a = 1;
      */
      if (BR2000A_0413() == 0)
        a = 1;
    } break;
    case dataset_id::mx1970a: {
      a = SUBFNUM.getRecoded();
    } break;
    case dataset_id::de1971a: {
      a = SUBFNUM.getRecoded();
      if (DE1971A_0441() == 1)
        a = 1;
    } break;
    case dataset_id::ie1971a:
    case dataset_id::ie1979a: {
      long n = 0;
      long m = 1;
      long v;
      for (long i = 1; i <= countPeople(); i++) {
        if (dataSet == dataset_id::ie1971a)
          v = IE1971A_0400(i);
        else
          v = IE1979A_0400(i);
        if (v == 1) {
          n++;
          m = n;
        } else if (v > 1 && v < 4) {
          if (n == 0)
            m = 1; // if spouse/child precedes the first head
          else
            m = n;
        } else // TODO not sure SUBFNUM is the right var here
          m = SUBFNUM.getRecoded(i);
        if (i == PERNUM())
          a = m;
      }
    } break;
    default:
      a = 1;
    }

    setData(a);
  }
};