Thank you so much for the video. My problem is that Stata reads comma (which I used as a decimal place separator) as string. When I destring variable, replace force , it just turns it into byte and the byte is just a dot. My number disappears. I do not understand how I can make Stata read my number with decimal places, as a numeric value. How can this be solved? Many thanks
Hello! Thank you for your comment. Did you try the dpcomma option in the destring command? --> destring varlist, dpcomma If you have commas as thousand separators, this could also help: destring var, replace ignore(",") force Hope this helps!
@@SteffensClassroom I did but in the end 'destring varlist, dpcomma replace'' worked. Thank you so much for replying. You have no idea how straightforward and useful your videos have been for someone who has just started using this program
Thank you for the video. I have tried to tostring a variable using both tostring varlist, replace and tostring varlist, gen(new varlist) but both failed. It said "variable cannot be converted reversibly; no replace/ generate". FYI, my numeric variable is 16 digits. How can i solve this? Thank you in advance
I believe you can find a solution here: www.statalist.org/forums/forum/general-stata-discussion/general/1310789-cannot-be-converted-reversibly-no-replace Hope this helps!
Yes indeed. I solved it with no replace. Did it work for you? Remember, you can also use the option to give your newly converted variable a specific name rather than replacing the existing one. See the options :)
these two didnt work but ive found something else. if numeric number is larger than 11 digits it doesnt work the easy way to return to string, which was my problem
i want to convert a variable that is numeric to a string but the variable is numeric because it is labelled and not because it is stored as a numeric. So say variable X is labelled x where in x, 0 "No" 1 "Yes" Now I want X to be a string but stata keeps changing the label values 0 and 1 into a string and not No and Yes. Any help? For example, in your example dataset, convert the variable foreign into a string so that now foreign is in red.
Hi Virginia, I think I see what you mean. The problem is that Stata does not let you label a string variable. So if you convert a numeric to a string, you lose the values labels that was assigned. Instead you can use the replace command if you want to change it.
so helpful!!!
Thank you so much for the video. My problem is that Stata reads comma (which I used as a decimal place separator) as string. When I destring variable, replace force , it just turns it into byte and the byte is just a dot. My number disappears. I do not understand how I can make Stata read my number with decimal places, as a numeric value. How can this be solved? Many thanks
Hello! Thank you for your comment. Did you try the dpcomma option in the destring command? --> destring varlist, dpcomma
If you have commas as thousand separators, this could also help: destring var, replace ignore(",") force
Hope this helps!
@@SteffensClassroom I did but in the end 'destring varlist, dpcomma replace'' worked. Thank you so much for replying. You have no idea how straightforward and useful your videos have been for someone who has just started using this program
Thank you for the video. I have tried to tostring a variable using both tostring varlist, replace and tostring varlist, gen(new varlist) but both failed. It said "variable cannot be converted reversibly; no replace/ generate". FYI, my numeric variable is 16 digits. How can i solve this? Thank you in advance
I believe you can find a solution here:
www.statalist.org/forums/forum/general-stata-discussion/general/1310789-cannot-be-converted-reversibly-no-replace
Hope this helps!
@@SteffensClassroom thank you. I'll look into it 🙏🏻
what if i get this error: variable_xy cannot be converted reversibly; no replace ?
Yes indeed. I solved it with no replace.
Did it work for you?
Remember, you can also use the option to give your newly converted variable a specific name rather than replacing the existing one. See the options :)
these two didnt work but ive found something else. if numeric number is larger than 11 digits it doesnt work the easy way to return to string, which was my problem
Thanks for getting back on it! Happy it worked out
i want to convert a variable that is numeric to a string but the variable is numeric because it is labelled and not because it is stored as a numeric. So say variable X is labelled x where in x, 0 "No" 1 "Yes" Now I want X to be a string but stata keeps changing the label values 0 and 1 into a string and not No and Yes. Any help?
For example, in your example dataset, convert the variable foreign into a string so that now foreign is in red.
Hi Virginia,
I think I see what you mean. The problem is that Stata does not let you label a string variable. So if you convert a numeric to a string, you lose the values labels that was assigned. Instead you can use the replace command if you want to change it.
I COULD KISS YOU, thank you!