Hi all,
I've recently moved to STATA from more point-and-click interfaces (i.e. SPSS), and am having trouble adapting to syntax use. I've recently came across an issue while running a simple loop. It's been an aggravating couple of hours.
Specifically, I am trying to replace the values in 'rows' 166, 185, 198, 205, etc... with the word "missing".
Please see:
foreach x in 166 185 {
2. replace example_variable_1_text = "missing" in "`x'"
3. }
'"166' invalid observation number
r(198);
Many thanks,
Shawn
Related Posts with Coding Loops
How to save subsets of a variable ? Code: * Example generated by -dataex-. To install: ssc install dataex clear input str6 id byte(inde…
How to analyze interaction effects after fixed effects count data regression with panel?Hi Statalisters, My current project is using count data model to analyze panel data with fixed effe…
Sysuse auto/tabI have these two deliverables: 5. Find the mean, median, min and max winsorized Z-Score for the who…
Difference-in-Differences with Multiple Treatment Strengths/DosagesHi. I am trying to run a DiD regression to analyze the effect of education policy implementation on …
Looping egen mean weightHi all, I am supposed to get a single mean_weight variable. Original egen code: egen weight_mean =…
Subscribe to:
Post Comments (Atom)
0 Response to Coding Loops
Post a Comment