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]

Re: st: CSV read with limits


From   Joerg Luedicke <[email protected]>
To   [email protected]
Subject   Re: st: CSV read with limits
Date   Fri, 11 Mar 2011 15:30:52 -0500

On Fri, Mar 11, 2011 at 12:16 PM, Argyn Kuketayev
<[email protected]> wrote:

> the file is 6GB, too large. There's >100 variables, and I need only 3 or 4.
>

RE variable selection: If you know the column positions of your
variables you could try -infile- as shown in the example below. In the
example, a data set with 20 variables is created and saved as csv
file. Then, 4 variables from column 5, 10, 15, and 20 are read:

/*Example*/

clear
set obs 100
forvalue i= 1/20{
gen var`i'=rnormal()
}
outsheet using test1.csv, comma replace

infile  _skip(4) vno1 _skip(4) vno2 _skip(4) vno3 _skip(4) vno4 using
test1.csv, clear

/*end example*/


J.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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