Hi can anyone help me with my code
item Apple
len = 6
Apple has valuesets from A to E
Value of Apple = AHBZC
do numeric i = 1 while i<=6
if !Apple[i:1] in valuesets then
impute(Apple,); /// How can i remove the answers that is not in the valuesets? i want the output to be "ABC"
endif;
enddo;
Thanks.
Editing in Batch Edit
-
- Posts: 1883
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: Editing in Batch Edit
Try this:
do numeric ctr = length(strip(APPLE)) while ctr > 0 by -1
if not invalueset(APPLE[ctr:1], APPLE_VS1) then
APPLE = APPLE[1:(ctr - 1)] + APPLE[ctr + 1];
endif;
enddo;
if not invalueset(APPLE[ctr:1], APPLE_VS1) then
APPLE = APPLE[1:(ctr - 1)] + APPLE[ctr + 1];
endif;
enddo;
Re: Editing in Batch Edit
I'm not sure if you used CSPro to collect the data, but if so, you should be restricting the allowable responses by defining a value set for the question. During entry you should utilize the isChecked() function, as it will not allow out-of-range values to be entered.
https://www.csprousers.org/help/CSPro/i ... ction.html
Sherrell
https://www.csprousers.org/help/CSPro/i ... ction.html
Sherrell
Re: Editing in Batch Edit
Hi, thanks for this.