How to convert string to numeric data in Stata| Destring in Stata

Поделиться
HTML-код
  • Опубликовано: 15 июл 2024
  • In stata sometimes when we donwload data from web or import it from csv or excel file it is in string or text format. This video explains how to convert text variable into numeric form in state.
    Download exercise file:
    payhip.com/b/UCkle
    00:00 Intro to Destring
    1:50 Convert string to numeric
    5:52 Syntax of command
    7:51 Remove dollar sign from numbers
    8:44 Remove text (NULL,NA etc) from variable
    11:17 Convert percentages into fractions
    Download Do/Data file from the following link:
    thedatahall.com/how-to-conver...
    Best 10 Introductory Econometrics Books
    thedatahall.com/best-10-intro...
    Econometric Analysis of Cross Section and Panel Data by Jeffrey M. Wooldridge
    amzn.to/4220RUA
    Introductory Econometrics for Finance by Chris Brooks
    amzn.to/3HwmOmM
    An Introduction to Modern Econometrics Using Stata by Christopher F. Baum
    amzn.to/42prKBT
    Microeconometrics Using Stata by A. Colin Cameron and Pravin K. Trivedi
    amzn.to/42ra88r
    Website: thedatahall.com
    Disclaimer: Some links are affiliate links that help the channel at no cost to you.

Комментарии • 19

  • @ProffyChaos
    @ProffyChaos 6 месяцев назад

    thank you for your helpful video. Much easier to understand the official Stata stuff.

  • @ppp3729
    @ppp3729 Год назад +1

    Absolute Genius you are! Incredible!!!!! You should definately getting more reviews. I am so glad your videos are naturally found on Google - thank you 🙏🙏♥

  • @taylarh
    @taylarh Год назад +1

    Thank you very much for this video! I'm very new to econometrics and this has saved my dissertation! :)

  • @guidoverosimile2734
    @guidoverosimile2734 Год назад

    Grazie amo

  • @varunmiglani110
    @varunmiglani110 Год назад

    need help i have string variable . 5 acres 5 acre when i use command destring Whatisthetotallandinacres, gen(ttlown1) i("acre" "acres" " acre*") i get contains characters not specified in ignore(); no generate

    • @thedatahall
      @thedatahall  Год назад +1

      U can only use one string in ignore option. In this case u might want to use subinstr function. Check my video on string variable

    • @varunmiglani110
      @varunmiglani110 Год назад

      @@thedatahall thanks, query resolved

    • @thedatahall
      @thedatahall  Год назад +1

      That is great. How did you resolved it...i e. What command/function did u uses

    • @varunmiglani110
      @varunmiglani110 Год назад +1

      @@thedatahall Seek your feedback, i ran following commands as i had acre acres in my data.
      gen ttlown3= subinstr(ttlown2,"acre"," " ,.)
      gen ttlown4= subinstr(ttlown3,"s"," " ,.)
      replace ttlown4=trim(ttlown4)

  • @varunmiglani110
    @varunmiglani110 Год назад

    Useful video. request for advice: If we have data like 100,000. How do we get rid of comma . we dont want to replace it with decimal

    • @thedatahall
      @thedatahall  Год назад +1

      You can try ignore option in destring
      Destring variable,ignore(",")

    • @varunmiglani110
      @varunmiglani110 Год назад

      @@thedatahall thanks. also what if my data column has
      Rs.18,000
      rs.5750
      I need only numbers in cell. i want to ignore Rs. rs. and ,

    • @thedatahall
      @thedatahall  Год назад +1

      You can use subinstr function check my latest video "working with strings"

    • @thedatahall
      @thedatahall  Год назад +1

      You are our regular viewer and i enjoy your queries. Do promote our channel in your academic circle. Thanks

    • @varunmiglani110
      @varunmiglani110 Год назад

      @@thedatahall yes , I teach Stata to my undergraduate students, i have shared your videos as reference