|
|
|
||||
|
|
|||||
This example uses count to count the number of times 0 appears among v1-v3 (putting it in z1) and likewise for v4-v6 (putting the count in z2). Then, if z1 is 3, then 9999 is placed in v1-v3 using a do repeat loop. The same is done for v4-v6.
data list free / v1 to v6. begin data. 0 0 0 1 0 1 1 1 1 1 1 0 0 1 1 0 0 0 0 0 0 0 0 0 end data. count z1=v1 to v3 (0). count z2=v4 to v6 (0). do repeat x=v1 to v3. if z1=3 x=9999. end repeat. do repeat x=v4 to v6. if z2=3 x=9999. end repeat. execute.
UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services