Working With String Variables in Stata
HTML-код
- Опубликовано: 26 май 2023
- In this video, we discuss how to extract specific text from a string variable using substr and the word function. Further, how to count the number of characters in the string variable or count the number of words in the string variables. How to remove white spaces from the string variable or convert the case to text to upper, lower, or proper case. Check the position of specific characters in the text, or split a string variable into multiple variables.
Download the exercise file:
payhip.com/b/1XGra
Download Data and Do file:
thedatahall.com/cleaning-extr...
Website: thedatahall.com
As an Amazon Associate, I earn from qualifying purchases.
very useful sir thanks for video
So nice of you
thank you so much
Welcome
very useful commands for data management
Informative as usual. I have a suggestion to please upload the do file in description of the video.
Thnaks for the suggestion. I have added a link to the files in the description of this video. We will do it for other videos as well.
Many thaks@@thedatahall
i have data in some cell it is: "Received" in another cell: Continuing without support now i want for both these observations to get a code of 1 in newly generated variable. how to put two criteria in strmatch
This is a very useful video. I want to ask how do we match multiple words? Like if I want to look for any of the multiple words in the variable data?
Please look into the inlist function, i do have a video on that, if it doesn't work the n send me an email at info@thedatahall.com along with example data.
Is there any way to identify blank spaces in string variables? I do not need to remove it, just to identify it
You can use following command
gen var=1 if regexm(variable_name," ")==1