-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathIRS_Revoked_Exempt_Orgs.Rmd
More file actions
131 lines (70 loc) · 3.48 KB
/
IRS_Revoked_Exempt_Orgs.Rmd
File metadata and controls
131 lines (70 loc) · 3.48 KB
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
# ORGANIZATIONS WITH 501(c)(3) STATUS REVOKED
From: https://apps.irs.gov/app/eos/forwardToRevokeDownload.do
Internal Revenue Service United States Department of the Treasury
>Using the link below, you may download as a zipped text file the most recent listing of all organizations whose federal tax exemption was automatically revoked for not filing a Form 990-series annual return or notice for three consecutive tax years. 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
>
>The Automatic Revocation information will be listed in rows, with each field of data separated by a pipe ('|') symbol. The following table describes the format and order of each field in a row, representing one Automatic Revocation listing.
## DATA DICTIONARY
Field | Notes
--------|------------------------------------------------------
EIN | Required; Employer Identification Number
Legal Name | Optional
Doing Business As Name | Optional
Organization Address | Optional
City | Optional
State | Optional
ZIP Code | Optional
Country | Required; Format: 2 Letter Country Code
Exemption Type | Optional; 501(c) status, FE (c)(3), (c)(4)
Revocation Date | Required; Format: DD-MON-YYYY
Revocation Posting Date | Required; Format: DD-MON-YYYY
Exemption Reinstatement Date | Optional; Format: DD-MON-YYYY
## BUILD THE DATASET
```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-revocation.zip"
download.file( url=file.url, "revoked.zip" )
unzip( "revoked.zip" )
file.remove( "revoked.zip" )
dat.revoked <- read.delim( file="data-download-revocation.txt",
header = FALSE,
sep = "|",
quote = "",
dec = ".",
fill = TRUE,
colClasses="character"
)
# add header information - variable names
var.names <- c("EIN", "Legal.Name", "Doing.Business.As.Name", "Organization.Address",
"City", "State", "ZIP.Code", "Country", "Exemption.Type", "Revocation.Date",
"Revocation.Posting.Date", "Exemption.Reinstatement.Date")
names( dat.revoked ) <- var.names
rm( var.names )
# change Tax.Year from YYYY-MM to YYYY
dat.revoked$Year <- substr( dat.revoked$Revocation.Date, 8, 11 )
# Note the types of exempt orgs (501c3, 501c4, etc.) are being revoked:
table( dat.revoked$Exemption.Type )
# New automatic revocation policy took effect in 2010 - note the purge
barplot( table( dat.revoked$Year ), col="gray", border="white" )
```
## EXPORT THE DATASET
```R
# AS R DATA SET
saveRDS( dat.revoked, file="RevokedOrganizations.rds" )
# AS CSV
write.csv( dat.revoked, "RevokedOrganizations.csv", row.names=F )
# IN STATA
install.packages( "haven" )
library( haven )
write_dta( dat.revoked, "RevokedOrganizations.dta" )
# IN SPSS - creates a text file and a script for reading it into SPSS
library( foreign )
write.foreign( df=dat.revoked, datafile="RevokedOrganizations.txt", codefile="CodeToLoadDataInSPSS.txt", package="SPSS" )
# if package 'foreign' is not installed first try: install.packages("foreign")
```