Hello everyone,
I am hoping that you all may be able to help with a question that I have been unsuccessfully trying to find an answer to. I would like to create a numeric variable that captures the count of characters in a string variable.
For example, in the dataset auto I would like to create a new variable "new_foreign" that includes the value 8 (corresponding to domestic) and the value 7 (corresponding to foreign).
Is there anyway to do this? The dataset I am working with has many thousands of cases and the character counts for the string variables I am interested in can also be quite long. Thank you all!
Best,
Daniel
Related Posts with Converting String Variables Questions
Note alignment in twoway graphsDear statalisters, I would like to align some notes below a twoway graph. So far I have only been a…
Explaining analysis with 'cluster' and 'robust' commandDear reader, I have a short and simple question. After doing an xtreg analysis, using a random effe…
Dynamic prediction after GARCHDear stata listers, I'm currently doing an event study using GARCH model to test the effects of cer…
Hide macro using Outreg2Hi everyone, I am estimating a Tobit Model, which (at the bottom of the table) reports sigma. Given…
test for paired sample with unequal variancesDear Statalists, I have two sample (348 cases and 371 controls) matched by sex and age. Now I would…
Subscribe to:
Post Comments (Atom)
0 Response to Converting String Variables Questions
Post a Comment