Announcement

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

  • Reshape

    Hi everyone,

    I have a data looks like below,
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str106 Show byte episode float(comment_nj_1 comment_zyq_1 comment_hsy_1)
    "Show"  1  414  4 140
    "Show"  2  527  9 304
    "Show"  3  774 25 308
    "Show"  4  993  2 572
    "Show"  5  761  5 384
    "Show"  6 1534  1 421
    "Show"  7 1231 11 429
    "Show"  8  893  9 320
    "Show"  9 1856  5 331
    "Show" 10 1123  4 638
    "Show" 11 1101  3 363
    "Show" 12 1641  4  31
    "Show" 13 3746 38 150
    end
    I want to change the format to the form as below:
    Click image for larger version

Name:	4.PNG
Views:	1
Size:	37.5 KB
ID:	1657977


    Anyone knows how to realize this in Stata?

    Thanks!

  • #2
    See here

    Comment


    • #3
      Code:
      reshape long comment , i(Show episode) j(ID) string 
      replace ID = "comment" + ID

      Comment


      • #4
        Originally posted by Jared Greathouse View Post
        Hi Jared,

        Thanks a lot for sharing the helpful resource!

        Comment


        • #5
          Originally posted by Nick Cox View Post
          Code:
          reshape long comment , i(Show episode) j(ID) string
          replace ID = "comment" + ID
          Hi Nick,

          The code solved my problem perfectly. Thanks a lot for your help!

          Comment


          • #6
            You're quite welcome

            Comment

            Working...
            X