Announcement

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

  • Separate and save data into even blocks

    I have 1000 rows of data but I want to separate and save them into 10 groups of 100 rows. What is the command to do that? I am new to STATA.
    I found this web page that lists data into blocks but I want to save them into separate blocks. For example the first 100 rows will be saved as 'group1', the second 100 rows will be saved 'group2', etc. I checked online for a solution before posting this question.

    Thanks

  • #2
    one way to do this,
    Code:
    forval i = 1(100)1000 {
    local j = `i' + 99
    use data in `i'/`j', clear
    save data`i', replace
    }

    Comment


    • #3
      Thanks for your response and for your quick reply!

      Comment

      Working...
      X