Hi,
Could I possibly have some help using chunky (or chunky8 - I've tried both!)
I have a 1.6GB txt file that I'd like to break down into chunks and convert to .dta files.
I've attempted using chunky, and chunky8 but am getting error messages for both. I also considered using the gssplit software but a bit wary of this not knowing much about it and in view of the confidentiality of the data.
Here is my attempt using chunky:
chunky using "Delivery1_Table1.txt", chunksize (100000KB) header(include) stub("Table1 data/import")
Chunking using the following settings:
Chunksize: 100,000,000
Memory: 33,554,432
Bites: 3
Bitesize: 33,333,333
Include header: patid\x09pracid\x09yob\x09gender\x09followup_start \x09followup_end\x09medcodeid\x
> 09value\x09numunitid\x09obsdate\x0d\x0a
(for reference: EOL characters 0d0a (CRLF) indicate Windows, 0a (LF) Unix and 0d (CR) Mac. 09 is th
> e TAB character.)
file Table1 data/import0001.txt could not be opened
fopen(): 603 file could not be opened
chunkfile(): - function returned error
<istmt>: - function returned error [1]
.................................................. ............................................
And here is my attempt using chunky8 (before I had heard about chunky). I felt that I'd nearly got this one going, but have no idea why it objects to an index of 1.
*Set up chunksize and locals for the loop:
local part 0
local index 1
local chunksize 2000000
tempfile chunkfile
*Check var names to see what you want to keep:
chunky8 using "Delivery1_Table1.txt", list
*Loop until the end of the file is reached:
while r(eof)!=1{
chunky8 using "Delivery1_Table1.txt" ///
index(`index') chunk(`chunksize') ///
saving("`chunkfile'", replace) keepfirst
if r(eof) {
continue, break
}
else {
local index `r(index)'
}
import delimited "`chunkfile'", clear delimiter("\t")
keep oatid yob gender followup_start medcodeid value numunitid
save test_`++part', replace
}
invalid 'index'
Thanks for looking at my query. Sorry if it's really obvious what I'm doing wrong - sadly it's not obvious to me!
Jemima
Could I possibly have some help using chunky (or chunky8 - I've tried both!)
I have a 1.6GB txt file that I'd like to break down into chunks and convert to .dta files.
I've attempted using chunky, and chunky8 but am getting error messages for both. I also considered using the gssplit software but a bit wary of this not knowing much about it and in view of the confidentiality of the data.
Here is my attempt using chunky:
chunky using "Delivery1_Table1.txt", chunksize (100000KB) header(include) stub("Table1 data/import")
Chunking using the following settings:
Chunksize: 100,000,000
Memory: 33,554,432
Bites: 3
Bitesize: 33,333,333
Include header: patid\x09pracid\x09yob\x09gender\x09followup_start \x09followup_end\x09medcodeid\x
> 09value\x09numunitid\x09obsdate\x0d\x0a
(for reference: EOL characters 0d0a (CRLF) indicate Windows, 0a (LF) Unix and 0d (CR) Mac. 09 is th
> e TAB character.)
file Table1 data/import0001.txt could not be opened
fopen(): 603 file could not be opened
chunkfile(): - function returned error
<istmt>: - function returned error [1]
.................................................. ............................................
And here is my attempt using chunky8 (before I had heard about chunky). I felt that I'd nearly got this one going, but have no idea why it objects to an index of 1.
*Set up chunksize and locals for the loop:
local part 0
local index 1
local chunksize 2000000
tempfile chunkfile
*Check var names to see what you want to keep:
chunky8 using "Delivery1_Table1.txt", list
*Loop until the end of the file is reached:
while r(eof)!=1{
chunky8 using "Delivery1_Table1.txt" ///
index(`index') chunk(`chunksize') ///
saving("`chunkfile'", replace) keepfirst
if r(eof) {
continue, break
}
else {
local index `r(index)'
}
import delimited "`chunkfile'", clear delimiter("\t")
keep oatid yob gender followup_start medcodeid value numunitid
save test_`++part', replace
}
invalid 'index'
Thanks for looking at my query. Sorry if it's really obvious what I'm doing wrong - sadly it's not obvious to me!
Jemima
Comment