Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Importing Non-contiguous Column/Row Ranges

    Hi all!


    I'm trying to load a large .csv dataset with SE. To save space, I want to only import the columns that I need -- and not a number of string variables -- but they're not a contiguous set.

    I'm looking for something akin to: import delimited filename.csv, colrange(3 5 21)

    I've only found the colrange and rowrange options to work with continuous ranges like 3:21. Does anyone know of a way to efficiently accomplish this?


    Any help is much appreciated!

    Thanks,

    Clay

  • #2
    First, have you tried importing the entire csv dataset and confirmed that you cannot do so? Because the easiest thing to do is to import the entire dataset and then just keep the variables (columns) that you are interested in.

    With that out of the way, it seems to me that you will have to import each range of one or more contiguous columns separately, save the results as a Stata dataset, and use
    merge 1:1 _n to combine them.

    Comment


    • #3
      Merge is exactly the right answer, but this also leads to a feature request: A colrange option that processes a numlist rather than [start: finish].

      Comment


      • #4
        Originally posted by Chris Ruebeck View Post
        Merge is exactly the right answer, but this also leads to a feature request: A colrange option that processes a numlist rather than [start: finish].
        This is a very important feature for those of us working with big data!

        Comment

        Working...
        X