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.
Country specific time trends with first-differenced regressionDear all, I am running a first-differences regression and was wondering if country specific time tr…
DATE ***Please help***Hi all, I am trying to put the day, month and year columns in one column. So the format is as foll…
expanding single observation into panel data with observations for each year an item existsDear , I want to transform my dataset into panel dataset. Currently my dataset looks like this (fi…
Continuous dependent variable, use of regressionI am trying do make some descriptive statistic. In my dataset I have ID, Age, time from start of bei…
Help on Thesis : Migrant wage gap Data Analysis.Hi, My thesis is on assessing the impact of nationality on workers earnings in UK. I have downloade…
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