Announcement

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

  • reshape?

    Dear All, How can I move from
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float patentid str16 variable str10 value
    2951 "专利分类号1" "B21D"
    2951 "专利分类号2" "C21D"
    end
    to
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float patentid str16(专利分类号1 专利分类号2)
    2951 "B21D" "C21D"
    end
    Thanks.
    Ho-Chuan (River) Huang
    Stata 17.0, MP(4)

  • #2
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float patentid str16 variable str10 value
    2951 "专利分类号1" "B21D"
    2951 "专利分类号2" "C21D"
    end
    
    reshape wide value , i(patentid) j(variable) string
    rename value* *
    Res.:

    Code:
    . l
    
         +--------------------------------+
         | patentid   专利分~1   专利分~2 |
         |--------------------------------|
      1. |     2951       B21D       C21D |
         +--------------------------------+

    Comment

    Working...
    X