-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathIRS-Current-Exempt-Orgs-List.rmd
108 lines (55 loc) · 2.67 KB
/
IRS-Current-Exempt-Orgs-List.rmd
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
# CURRENT EXEMPT ORGANIZATIONS LIST
From the IRS Website: https://apps.irs.gov/app/eos/forwardToPub78Download.do
Publication 78 Data Download
Using the link below, you may download as a zipped text file the most recent list of organizations eligible to receive tax-deductible charitable contributions (Pub. 78 data). The download file is a large compressed file, from which you may extract a very large delimited text file. This file is updated on a monthly basis. Opening the file using word processing software may prevent formatting/appearance issues that may be present if the file is viewed with a text editing program. Information is available describing the layout and contents of the downloadable file.
Format: Pipe-Delimited ASCII Text
## Data Dictionary
Variable | Notes
--------- |-------------------------------------------------------------
EIN | Unique Employee Identification Number for each nonprofit
Legal Name | Name of nonprofit (optional)
City | Location of nonprofit (optional)
State | Location of nonprofit (optional)
Country | If the country is null, it is assumed to be the United States
Deductibility Status | PC, PF, EO, ... (optional)
*Note that this dataset is current, not cumulative, meaning it lists only entities with current 501c3 status*.
## BUILD THE DATABASE
```R
# create subdirectory for the data
getwd()
dir.create( "IRS Nonprofit Data" )
setwd( "./IRS Nonprofit Data" )
# download and unzip
file.url <- "https://apps.irs.gov/pub/epostcard/data-download-pub78.zip"
download.file( url=file.url, "exemptorgs.zip" )
unzip( "exemptorgs.zip" )
file.remove( "exemptorgs.zip" )
dat.exempt <- read.delim( file="data-download-pub78.txt",
header = FALSE,
sep = "|",
quote = "",
dec = ".",
fill = TRUE,
colClasses="character"
)
# add header information - variable names
var.names <- c("EIN", "Legal.Name", "City", "State",
"Country", "Deductibility.Status")
names( dat.exempt ) <- var.names
rm( var.names )
```
## EXPORT THE DATASET
```R
# AS R DATA SET
saveRDS( dat.exempt, file="ExemptOrganizations.rds" )
# AS CSV
write.csv( dat.exempt, "ExemptOrganizations.csv", row.names=F )
# IN STATA
install.packages( "haven" )
library( haven )
write_dta( dat.exempt, "ExemptOrganizations.dta" )
# IN SPSS - creates a text file and a script for reading it into SPSS
library( foreign )
write.foreign( df=dat.exempt, datafile="ExemptOrganizations.txt", codefile="CodeToLoadDataInSPSS.txt", package="SPSS" )
# if package 'foreign' is not installed first try: install.packages("foreign")
```