program define taxpuf35
version 11
/*
data and results description http://www.nber.org/taxsim/pctaxsim.ndx
*/
syntax
preserve
set varabbrev off

! /bin/rm -f results.raw txpydata.raw
display "taxpuf35 v35.1"

forvalues X = 1/255 {
  capture confirm variable data`X'
  if (_rc) gen data`X' = 0
}
order _all,seq
capture gen idtl = 0
capture gen  mtr = 85

display "Write " _N " records to txpydata.raw"
outsheet data1-data255 using txpydata.raw, nonames comma
findfile taxpuf35.exe
di "`r(fn)'"
set trace on
if "`c(os)'"=="Unix" {
 ! chmod ugo+x `r(fn)'
}
set trace off
!`r(fn)' <txpydata.raw   >results.raw
clear
insheet taxsimid year state c1-c156 s1-s12 using results.raw,comma
save results, replace
restore
merge 1:1 _n using results ,nogen
end