File: ssdi_aid.ll

package info (click to toggle)
lifelines 3.0.50-2
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 11,140 kB
  • ctags: 6,517
  • sloc: ansic: 57,468; xml: 8,014; sh: 4,255; makefile: 848; yacc: 601; perl: 170; sed: 16
file content (260 lines) | stat: -rw-r--r-- 8,436 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
/*
 * @progname       ssdi_aid.ll
 * @version        1
 * @author         Jim Eggert (eggertj@ll.mit.edu)
 * @category       
 * @output         Text
 * @description

This LifeLines report program generates a text file that lists
people who are likely to be in the Social Security Death Index.
The SSDI starts in 1962 and is periodically updated to include
more recent years.  This program guesses birth and death years
to make its determinations.  If it finds a person likely to be
in the SSDI, it searches for the string SSDI in their notes to
indicate that an SSDI entry has already been found.  If so, it
prints an asterisk to indicate found entries.

The output persons are in database order.  Women are output in
their own name and any married name.  To alphabetize the names,
you can use Unix sort:

  sort -b +1 ss.out > ss.sort

ssdi_aid - a LifeLines program to aid in the use of the U.S. Social
           Security Death Index
          by Jim Eggert (eggertj@ll.mit.edu)
          Version 1, 28 June 1995
*/

global(byear_delta)
global(byear_est)
global(byear_est_delta)

global(mother_age)
global(father_age)
global(years_between_kids)
global(oldage)

proc main() {
  indiset(pset)

  set(mother_age,23)  /* assumed age of first motherhood */
  set(father_age,25)  /* assumed age of first fatherhood */
  set(years_between_kids,2) /* assumed years between children */
  set(oldage,90)

  getindi(person)
  while(person) {
    addtoset(pset,person,1)
    getindi(person)
  }

  getintmsg(minage,"Enter minimum age for listing:")

  set(namewidth,50)  /* change this value as needed */
  "key" col(8) "@LAST, First Middle [MAIDEN]"
  set(bcol,add(8,namewidth))
  col(bcol) "Birthdate"
  set(dcol,add(25,namewidth))
  col(dcol) "Death\n"

  print("Finding descendants")
  set(pset,union(pset,spouseset(pset)))
  set(pset,union(pset,descendantset(pset)))
  print("' spouses")
  set(pset,union(pset,spouseset(pset)))
  print("... done.\n")

  set(thisyear,atoi(year(gettoday())))
  set(byearend,sub(thisyear,minage))

  print("Traversing individuals...")
  forindiset(pset,person,pval,pnum) {
    set(byear,0)
    set(bdate,"")
    if (b,birth(person)) {
      extractdate(b,bday,bmonth,byear)
      set(bdate,date(b))
    }
    if (not(byear)) {
      if (b,baptism(person)) {
        set(bdate,date(b))
      }
    }
    call estimate_byear(person)
    set(byear,sub(byear_est,byear_est_delta))
    if(and(byear_est,not(strlen(bdate)))) {
        set(bdate,save(concat("c ",d(byear_est))))
    }

    set(dyear,0)
    if (d,death(person)) {
      extractdate(d,dday,dmonth,dyear)
    }
    if (not(dyear)) {
      if(d,burial(person)) {
        extractdate(d,dday,dmonth,dyear)
      }
    }
    if (dyear) {
      if (or(index(date(d),"ABT",1),eq(dmonth,0))) { set(dyear,add(dyear,5)) }
      if (index(date(d),"AFT",1)) {
        set(oldyear,add(byear,oldage))
        if (gt(oldyear,dyear)) { set(dyear,oldyear) }
      }
    }

    if (or(ge(dyear,1962),
           and(not(dyear),le(byear,byearend)))) {
      set(star,0)
      fornotes(inode(person),note) {
        if (index(note,"SSDI",1)) { set(star,1) }
      }
      if (star) { "*" } else { " " }
      key(person) col(8)
      set(nsp,nspouses(person))
      set(no_mname,1)
      if (and(female(person),ne(nsp,0))) {
        set(maidenname,save(concat(", ",fullname(person,1,1,100))))
        spouses(person,spouse,fam,spnum) {
          if (eq(spnum,nsp)) {
            if (spousesurname,surname(spouse)) {
              trim(concat(upper(spousesurname),maidenname),namewidth)
              set(no_mname,0)
            }
          }
        }
        if (no_mname) { "*" }
      }
      if (no_mname) { fullname(person,1,0,namewidth) }
      col(bcol) bdate col(dcol) long(d) nl()
    }
  }
}

proc estimate_byear(person) {
    set(byear_est,0)
    set(byear_est_delta,neg(1))
    if (byear,get_byear(person)) {
        set(byear_est,byear)
        set(byear_est_delta,byear_delta)
    }
    else { /* estimate from siblings */
        set(older,person)
        set(younger,person)
        set(yeardiff,0)
        set(border,0)
        set(this_uncertainty,1)
        while (and(not(byear_est),or(older,younger))) {
            set(older,prevsib(older))
            set(younger,nextsib(younger))
            set(yeardiff,add(yeardiff,years_between_kids))
            set(this_uncertainty,add(this_uncertainty,1))
            if (older) {
                set(border,add(border,1))
                if (byear,get_byear(older)) {
                    set(byear_est,add(byear,yeardiff))
                    set(byear_est_delta,this_uncertainty)
                }
            }
            if (and(not(byear_est),younger))  {
                if (byear,get_byear(younger)) {
                    set(byear_est,sub(byear,yeardiff))
                    set(byear_est_delta,this_uncertainty)
                }
            }
        }
    }
    if (not(byear_est)) { /* estimate from parents' marriage */
        if (m,marriage(parents(person))) { extractdate(m,bd,bm,my) }
        if (my) {
            set(byear_est,add(add(my,mul(years_between_kids,border)),1))
            set(byear_est_delta,add(border,1))
        }
    }
    if (not(byear_est)) { /* estimate from first marriage */
        families(person,fam,spouse,fnum) {
            if (eq(fnum,1)) {
                if (b,birth(spouse)) { extractdate(b,bd,bm,by) }
                if (m,marriage(fam)) { extractdate(m,bd,bm,my) }
                if (by) {
                    if (female(person)) {
                        set(byear_est,add(by,sub(father_age,mother_age)))
                    }
                    else {
                        set(byear_est,sub(by,sub(father_age,mother_age)))
                    }
                    set(byear_est_delta,5)
                }
                elsif (my) {
                    if (female(person)) { set(byear_est,sub(my,mother_age)) }
                    else { set(byear_est,sub(my,father_age)) }
                    set(byear_est_delta,5)
                }
                else {
                    children(fam,child,cnum) {
                        if (not(byear_est)) {
                            if (byear,get_byear(child)) {
                                if (female(person)) {
                                set(byear_est,sub(sub(byear,
                                        mul(sub(cnum,1),years_between_kids)),
                                        mother_age))
                                }
                                else {
                                set(byear_est,sub(sub(byear,
                                        mul(sub(cnum,1),years_between_kids)),
                                        father_age))
                                }
                                set(byear_est_delta,add(5,cnum))
                            }
                        }
                    }
                }
            }
        }
    }
    if (not(byear_est)) { /* estimate from parents' birthyear */
        if (byear,get_byear(mother(person))) {
            set(byear_est,add(byear,mother_age))
        }
        else {
            if (byear,get_byear(father(person))) {
                set(byear_est,add(byear,father_age))
            }
        }
        if (byear) {
            set(byear_est_delta,5)
            set(older,person)
            while(older,prevsib(older)) {
                set(byear_est,add(byear_est,years_between_kids))
                set(byear_est_delta,add(byear_est_delta,1))
            }
        }
    }
}

func get_byear(person) {
    set(byear,0)
    if (person) {
        if (b,birth(person)) { extractdate(b,day,month,byear) }
        if (byear) {
            set(byear_delta,0)
            set(dstring,trim(date(b),3))
            if (not(strcmp(dstring,"BEF"))) { set(byear_delta,3) }
            elsif (not(strcmp(dstring,"AFT"))) { set(byear_delta,3) }
            elsif (not(strcmp(dstring,"ABT"))) { set(byear_delta,2) }
        }
        else {
            if (b,baptism(person)) { extractdate(b,day,month,byear) }
            if (byear) {
                set(byear_delta,1)
                set(dstring,trim(date(b),3))
                if (not(strcmp(dstring,"BEF"))) { set(byear_delta,3) }
                elsif (not(strcmp(dstring,"AFT"))) { set(byear_delta,3) }
                elsif (not(strcmp(dstring,"ABT"))) { set(byear_delta,2) }
            }
        }
    }
    return(byear)
}