Announcement

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

  • creating a subset of a larger data set

    Hi all, I have a big dataset that is about 60 thousand observation as follows:
    Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10 Q11 Q12 Q13 Qn
    0 0 1 2 -1 1 0 0 1 1 1 -2 1 2 --
    1 2 -1 0 1 0 1 -2 -1 1 2 0 1 0 --
    2 1 0 1 -1 2 2 0 1 1 0 0 -1 0 --
    n -- -- -- -- -- -- -- -- -- -- -- -- -- --
    The first row has 60 questions that takes values from -2 to 2 and the first column corresponds to individuals
    I want to create a subset of this data as follows:
    Individual 0:
    Q1 Q2 Q3 Q4 Q5 Q6
    Q7 Q8 Q9 Q10 Q11 Q12
    Q13 Q14 Q15 Q16 Q17 Q18
    Q19 Q20 Q21 Q22 Q23 Q24
    Q25 Q26 Q27 Q28 Q29 Q30
    Q31 Q32 Q33 Q34 Q35 Q36
    Q37 Q38 Q39 Q40 Q41 Q42
    Q43 Q44 Q45 Q46 Q47 Q48
    Q49 Q50 Q51 Q52 Q53 Q54
    Q55 Q56 Q57 Q58 Q59 Q60
    Where every question of those corresponds to the answers listed above.
    I would greatly appreciate your help on this.
    Thank you.

  • #2
    In the interest of brevity, I illustrate below with a list of only six questions, but the method is general. Begin at the "Begin here"; the stuff above is to create a toy dataset used in the illustration.

    .ÿ
    .ÿversionÿ17.0

    .ÿ
    .ÿclearÿ*

    .ÿ
    .ÿ//ÿseedem
    .ÿsetÿseedÿ939925343

    .ÿ
    .ÿquietlyÿsetÿobsÿ100000

    .ÿ
    .ÿgenerateÿlongÿpidÿ=ÿ_nÿ-ÿ1

    .ÿ
    .ÿforvaluesÿiÿ=ÿ1/6ÿ{
    ÿÿ2.ÿÿÿÿÿÿÿÿÿgenerateÿbyteÿQ`i'ÿ=ÿruniformint(-2,ÿ2)
    ÿÿ3.ÿ}

    .ÿ
    .ÿ*
    .ÿ*ÿBeginÿhere
    .ÿ*
    .ÿframeÿputÿQ*ÿinÿ1,ÿinto(Criteria)

    .ÿquietlyÿfrlinkÿm:1ÿQ*,ÿframe(Criteria)

    .ÿquietlyÿkeepÿifÿCriteriaÿ==ÿ1

    .ÿlistÿpidÿQ*,ÿnoobsÿseparator(0)

    ÿÿ+-------------------------------------+
    ÿÿ|ÿÿÿpidÿÿÿQ1ÿÿÿQ2ÿÿÿQ3ÿÿÿQ4ÿÿÿQ5ÿÿÿQ6ÿ|
    ÿÿ|-------------------------------------|
    ÿÿ|ÿÿÿÿÿ0ÿÿÿ-2ÿÿÿÿ0ÿÿÿ-2ÿÿÿÿ0ÿÿÿ-1ÿÿÿ-2ÿ|
    ÿÿ|ÿ19168ÿÿÿ-2ÿÿÿÿ0ÿÿÿ-2ÿÿÿÿ0ÿÿÿ-1ÿÿÿ-2ÿ|
    ÿÿ|ÿ33974ÿÿÿ-2ÿÿÿÿ0ÿÿÿ-2ÿÿÿÿ0ÿÿÿ-1ÿÿÿ-2ÿ|
    ÿÿ|ÿ37610ÿÿÿ-2ÿÿÿÿ0ÿÿÿ-2ÿÿÿÿ0ÿÿÿ-1ÿÿÿ-2ÿ|
    ÿÿ|ÿ41242ÿÿÿ-2ÿÿÿÿ0ÿÿÿ-2ÿÿÿÿ0ÿÿÿ-1ÿÿÿ-2ÿ|
    ÿÿ+-------------------------------------+

    .ÿ
    .ÿframeÿdropÿCriteria

    .ÿ
    .ÿexit

    endÿofÿdo-file


    .


    With so many criteria, even with sixty thousand observations, unless there's a farily high correlation, you're liable not to have many matches.

    Comment


    • #3
      Thank you so much for your help

      Comment

      Working...
      X