Announcement

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

  • splitting string

    Dear all,

    I am wondering how to split data from a long string on the comma (like for example: Colruyt/okay,Carrefour/GB,Delhaize,Aldi/Lidl) and use the seperate answers here in a dummy. Creating the dummies works, but spitting the data keeps on giving errors. I tried doing it with strpos and split data, p(",") but I can't find the right answer.

    Thanks in advance!

  • #2

    I was wondering how you can go from this
    Click image for larger version

Name:	dfsf.png
Views:	1
Size:	16.7 KB
ID:	1541510

    to
    Click image for larger version

Name:	qsd.png
Views:	1
Size:	11.3 KB
ID:	1541511

    Comment


    • #3
      You said: "...spitting the data keeps on giving errors. I tried doing it with strpos and split data, p(",")"

      This does not give anyone enough information to help you, since we don't know exactly what you did. Per the FAQ, please show exactly what you typed and exactly what Stata responded. And, please read the FAQ about -dataex- so as to be able to present a data example in a way that will enable others to efficiently help you.

      Comment


      • #4
        Perhaps the extensively commented example code in post #8 of the recent topic linked to below can show you a direction for your problem.

        https://www.statalist.org/forums/for...lit-a-variable

        Comment

        Working...
        X