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.
thank you for your helpful video. Much easier to understand the official Stata stuff.
Glad you liked it
Absolute Genius you are! Incredible!!!!! You should definately getting more reviews. I am so glad your videos are naturally found on Google - thank you 🙏🙏♥
Thanks for kind words
Thank you very much for this video! I'm very new to econometrics and this has saved my dissertation! :)
Thanks for appreciation
Grazie amo
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
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
@@thedatahall thanks, query resolved
That is great. How did you resolved it...i e. What command/function did u uses
@@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)
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
You can try ignore option in destring
Destring variable,ignore(",")
@@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 ,
You can use subinstr function check my latest video "working with strings"
You are our regular viewer and i enjoy your queries. Do promote our channel in your academic circle. Thanks
@@thedatahall yes , I teach Stata to my undergraduate students, i have shared your videos as reference