Skip to content

Commit

Permalink
Merge pull request #48 from aaowens/2021
Browse files Browse the repository at this point in the history
support 2021
  • Loading branch information
aaowens authored Jun 16, 2024
2 parents 95920cc + 983fcac commit 234bbfd
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PSID"
uuid = "92fd0282-be9c-47fb-a489-f0d0a91db595"

version = "3.0.0"
version = "4.0.0"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Expand Down
26 changes: 13 additions & 13 deletions src/allfiles_hash.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"PSIDCodebook.xml": "f75da54745ceb7eb856d3a3f4e23a0ab920703dd5c9343bd9f00b3709f6f8262",
"psid.xlsx": "4f3755c40d4057ccc0443077cf62f77ecc62c35e4bec018c34a91a29a3d98961",
"PSIDCodebook.xml": "03a0df9078f33876f23d05a225dad4fe342c45449e894c4c1c540751cb5b09c3",
"psid.xlsx": "f5bd3387ca15e92de95486fe7e1c6de7213d73be6316b376c5a1050f04707f06",
"fam1968.zip": "38292539d020824be3ca3908c04093edf8d3ccef8dc44cb81147a2315e94cd00",
"fam1969.zip": "7942f14d8c0c3f42c05efa3fd6b90b011721e280f198fe6b78a417bb28dc9335",
"fam1970.zip": "07bf03d9aa9ca9258aff3546abf60e66447c02031819d5a552f4769ddb8bb90f",
Expand Down Expand Up @@ -31,16 +31,16 @@
"fam1995er.zip": "19ff652fa8f77e5f604dc4e75114a25c0d682204d00942dce8be96166c567fee",
"fam1996er.zip": "72bee0cae474e0a93fcd9621beabf961ef2e2b8caacbb4a79509a376e6084abd",
"fam1997er.zip": "3dd49c846446fcead1096f4cbcbc80ab0b294c4745042e9e2f061d9519993c48",
"fam1999er.zip": "94fe2c78bbe717345a686bdd726092532186de7d053b9a60a14b7bcfb4ad4201",
"fam2001er.zip": "44b7a67f4f5582d4d9e21a540d6f16cd2ea2bd8efbfa12307e29cab606f4356f",
"fam2003er.zip": "962a0cd6bbc6607402f18f51652a46be8457e5820297b87bae3d48f341a530db",
"fam2005er.zip": "aeed5c5b4752e15d90a1b0d4075ecfc40c4cb8fc08cb182d314cc951ab9b06ff",
"fam2007er.zip": "ce074884ce79799e52100b16b1179605075b3dbd700ba8ddbb85694b40ffb2f1",
"fam2009er.zip": "b8540fcc906e7d2dffa2b5be6ec5f93bb824bd866876755f1020f25170d97539",
"fam2011er.zip": "6dd98a428ca699287166dfeb04853d971ac5342d4051c00cdf4ff1377db5ee18",
"fam2013er.zip": "43a527b834dc31b753881d3ab03fe1a4c4f1dde7eb5aa2d77a7c3bb79095d15c",
"fam2015er.zip": "726236d3f9d25e804d2605eff6a6a11f322999530d27a2528d0d01cf31af6066",
"fam2017er.zip": "5ade1a3f42ed84c892fe8ff16365b85b0dc84ac66f4d454e291af12008e9b35d",
"fam1999er.zip": "58f8e98ac257fea19f37865201cf77fdd48234d92fa11867b7a2df7b212f3424",
"fam2001er.zip": "cb884a348f1012b25b342f519dd036e45f1e149cb7e4b65f27283414d58c9fbc",
"fam2003er.zip": "472f4108b0b61f95bb5fa4002ad7f8d400904c7a80fec7a4e264cc651f2a382f",
"fam2005er.zip": "4149598210bfadd6aa5be38edb464527ff683039b33d0113627fb2204ecafbfb",
"fam2007er.zip": "b382adcb0868c8b6a5294c114ac5538e9e580cef66584c7a46f24216c71d65ab",
"fam2009er.zip": "fbc930bc3444ca10fa2cb4e3e1142c6867c19ccc8640a491a044861a4d694af2",
"fam2011er.zip": "adcb9714d90941461c8f8b55d704f9214ee3d476b46f66c79fb4e9128ef93593",
"fam2013er.zip": "72d5670d84b6d4583dd7035e528bb1f090efc5e202a87ee043a118e8a9e5ce25",
"fam2015er.zip": "f243659e971fd49d5054ef349ccfac821e055ea41583ec2ebc07d291f49f4627",
"fam2017er.zip": "7232dd29d5728930105e669f33987c9e232fb9cafa982fba42680972f3738ae7",
"fam2019er.zip": "a5a19dbbff36ac9dab7f5ddc46b35ace0ae64e924b51e7e66507c1f8850a8bb7",
"ind2019er.zip": "583e541f2f8d8c9ea12e2f53e8f7594f525d95ad929f5ce804d030e1a593991d"
"fam2021er.zip": "e693b1037f6a4e643d23006293b4db980c39ad3f384fbd594e9b57a9bf9e7cce"
}
3 changes: 2 additions & 1 deletion src/construct_alldata.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function construct_alldata(famdatas, inddata; codemissings = true)
#readme = procvar
readme_ind = JSON3.read(read("output/ind_output.json", String), Vector{VarInfo5})

years = [collect(1968:1997); collect(1999:2:2019)]
years = [collect(1968:1997); collect(1999:2:2021)]
newdatas_ind = [DataFrame() for x in famdatas]
# Go year by year
for y_nx in eachindex(years)
Expand Down Expand Up @@ -138,6 +138,7 @@ function construct_alldata(famdatas, inddata; codemissings = true)
end
CSV.write("output/allinds.csv", allinds)
println("Finished constructing individual data, saved to output/allinds.csv")
return allinds
end

"""
Expand Down
4 changes: 2 additions & 2 deletions src/unzip_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ function readPSID(zipname)
end

function unzip_data()
years = [collect(1968:1997); collect(1999:2:2019)]
years = [collect(1968:1997); collect(1999:2:2021)]
filenames = [year <= 1993 ? "fam$year" : "fam$(year)er" for year in years]
datas = SortedDict(year => readPSID(filename) for (year, filename) in zip(years, filenames))
inddata = readPSID("ind2019er")
inddata = readPSID("ind2021er")
(famdatas = datas, inddata = inddata)
end
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ nrows_byind = [nrow(sdf) for sdf in groupby(alldata, "id_ind")]
@test maximum(nrows_byind) >= 41
@test maximum(nrows_byind) <= maximum(alldata.year) - minimum(alldata.year)

@test minimum(alldata.year) == 1968
@test maximum(alldata.year) == 2021

## fix income since it changed in 1993
inds = (alldata.year .<= 1993) .& (alldata.ishead .== true)
alldata.labor_inc_spouse[inds] .= alldata.labor_inc_pre_spouse[inds]
Expand Down

0 comments on commit 234bbfd

Please sign in to comment.