Announcement

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

  • Obtaining a part of the data

    Hello, I need help obtaining a part of the data, for example: from a numeric type column I need to extract the first two digits and put it in another column where it contains only the first digits. Also, I need to extract digits in middle position.
    263 / 5.000





    Resultados de traducción

    star_border

    Hello, I need help obtaining a part of the data, for example: from a numeric type column I need to extract the first two digits and put it in another column where it contains only the first digits. Also, I need to extract digits in middle position.






  • #2
    Without seeing an example of the data itself, I do not know how to advise you. Code for extracting the first two digits will depend on how many digits the numbers have, and whether each number has the same amount of digits. And it is not at all clear what you mean by "digits in the middle position." How many such digits, and what exactly is "the middle?"

    Please post back with an explanation, and a data example. For the data example, please use the -dataex- command. If you are running version 17, 16 or a fully updated version 15.1 or 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

    When asking for help with code, always show example data. When showing example data, always use -dataex-.

    Comment

    Working...
    X