Dear members of Statalist,
I am fairly new to Stata and I have been struggling with an issue I believe is related to the "foreach" command. In my dataset, I have a variable (related_diagnosis) which contains various ICD10-codes where I am interested to make a new categorical variable which encodes 1 if there is a value within that variable containing a specific letter ("G"). related_diagnosis is coded as a string variable. The variable contains thousands of observations, and looking for observations containing "G" would take a very long time. I suppose I should use a loop such as "foreach" to simplify this.
I've tried to search for a similar topic without success. If this is answered in another topic, I would be grateful if someone could provide the link discussing this topic.
Best,
Haakon
Related Posts with Using the foreach-command to find a spesific part among hundreds of observations in a string variable.
Option "in" for serrbar graph (multilevel model)Hello, I have made a multilevel model for which I want to plot the effects of one of the levels, wh…
Sequential partialling out of variables in linear regression: Is there such an algorithm and how is it called?Good afternoon, Suppose that my task is to obtain the residual vector in a multiple regression of Y…
logout with fix()Hello, I read that when using -logout- I can add fix(#) to adjust the sensitivity of fix method, and…
Bland-Altman difference Plot problem with codeHi all, I have been trying to draw a bland -altman difference plot Code: Code: batplot systolicd…
Working with large datasets, saving the dta files with different names in a loopDear all, I am working with several csv. file each having a size between 700 MB to 2 GIG. I need to…
Subscribe to:
Post Comments (Atom)
0 Response to Using the foreach-command to find a spesific part among hundreds of observations in a string variable.
Post a Comment