Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Stata 12 issues with .csv files


From   Daniel MacPherson <[email protected]>
To   [email protected]
Subject   st: Stata 12 issues with .csv files
Date   Wed, 2 Jan 2013 15:49:25 -0500

Hey Everyone,
I'm having issues with .csv files (Excel 32-bit) and Stata 12 64-bit.
I'm trying to append a large number of .csv files together. The append
command works with most of the files, but occasionally one of these
.csv files causes to Stata to crash and shut down immediately. I've
been able to isolate both the problematic files and the bad variables
within these files. They don't appear to be any different in format
than variables in non-problematic files. I've tried recasting the
variables into a set format before appending them but this hasn't
worked either. When I run the code on Stata 11.2 32-bit, I don't
encounter the problem. Any help would be appreciated. Thanks.
Below is the code I'm using:
clear all
set more off
cd C:\Users\macpherd\nal_project\
file open cd using c:\USERS\macpherd\nal_project\cd.txt, read
file read cd line
while r(eof)==0 {
cd `line'
local i=0
local round=substr("`line'",31,4)
cap erase Exmpt_`round'.dta
local files: dir . files "*.csv"
foreach f of local files {
drop _all
insheet using "`f'"
format mpid %9s
recast long homestead, force *** Doesn't work!!!***
keep mpid co_no land_use_code exempt_other homestead widow disable rnwl_energy
local y "land_use_code exempt_other homestead widow disable rnwl_energy"
foreach y of varlist `y' {
rename `y' `y'_`round'
}
if `i'>0 append using Exmpt_`round'
save Exmpt_`round', replace
local i=1
}
drop _all
file read cd line
}


Thanks.
Daniel
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index