Hi I'm trying to discard entry errors from a question response (q_text in example) with the unique identifier in an ID variable (orgid), but when the loop ran only the last ID had their value replaced. All of the IDs are correct so not sure why it only made the one change for the last value. I've included my code below with some edits for data privacy.
Code:
foreach id in AA026, AB007, CB024, CN096, ML162, MP095, NT027, NX016, OJ140, PL002 {
replace q_text = "" if orgid == "`id'"
}
I'm also posting the output from running the command as well. I realize this could be with a few additional lines but am thinking about future issues that have more than a few cases. Any and all help is appreciated!!!
Code:
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(0 real changes made)
(1 real change made)
0 Response to Trouble replacing values with foreach loop
Post a Comment