Announcement

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

  • Best way to create sequence of 2 variables repeated 150 times?

    Hi all,

    I'm trying to figure out how to capture text data for a systematic review, and I want to try creating a Stata-based data frame to export to Excel and extract data in Excel (most user-friendly for the student who is helping). I know one of the included articles has 150 questions and some number of (fewer) categories that correspond to each question, e.g.
    c1 q1 c2 q2 c2 q2 c3 q3 c3 q3
    Authenticate Can the user set a password? Authenticate Does it allow MFA? Evidence Does it incorporate guidelines? Evidence Does it have RCTs? Privacy Are data protected by encryption?
    etc. to c150 q150

    I started by creating the c1-c150 and q1-q150 variables with this:

    forvalues i=1(1)150 {
    cap drop c`i'
    gen c`i'=.
    cap drop q`i'
    gen q`i'=.
    }

    which worked great. After I used order _all, sequential, I now have c1-150 in order, then q 1-150 in order, but of course what I need is the above table: c1 q1 c2 q2 etc

    Is this possible in Stata? Thanks in advance for any suggestions!


    Michelle

  • #2
    Code:
    order _all, sequential
    is undoing the order you prefer, so don't do that.

    Comment


    • #3
      Nick, thanks as always. I wondered why it looked like it didn't, then I realized I was looking at the variables in the Variables pane in the main window and not the Data Editor. Of course they show up correctly in the actual data editor.

      Problem solved!

      Michelle
      Last edited by Michelle Carras; 31 Jul 2022, 10:02. Reason: Sorry; Statalist froze and led to this being posted multiple times. Sure wish we could delete posts but that doesn't seem possible.

      Comment


      • #4
        Nick, thanks as always. I wondered why it looked like it wasn't in the right order, then I realized I was looking at the variables in the Variables pane in the main window and not the Data Editor. Of course they show up correctly in the actual data editor.

        Problem solved!

        Michelle
        Last edited by Michelle Carras; 31 Jul 2022, 10:02. Reason: Sorry; Statalist froze and led to this being posted multiple times. Sure wish we could delete posts but that doesn't seem possible.

        Comment


        • #5
          Nick, thanks as always. I wondered why it looked like the variables weren't in the right order, then I realized I was looking at the variables in the Variables pane in the main window and not the Data Editor. Of course they show up correctly in the actual data editor.

          Problem solved!

          Michelle

          Comment

          Working...
          X