Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • inlist

    does inlist work both of the following ways?

    the first one searching fro values 91, 92 and 93 in the variable px1

    Code:
    replace x=1   if inlist(px1, 91, 92, 93)


    the second one searching for value 91 in varaibles px1, px2, px3

    Code:
    replace x=1   if inlist(91, px1,  px2,  px3,  px4)
    Thanks

  • #2
    Yes. Note that the second is equivalent to

    Code:
    replace x = 1 if 91 == px1 | 91 == px2 | 91 == px3 | 91 == px4
    which is equivalent to

    Code:
    replace x = 1 if px1 == 91  | px2 == 91| px3 == 91 | px4 == 91 
    as if x == y then necessarily y == x.

    It took me some time to see that the second form can be as useful as the first, and it's mathematical training to write one way (variable first, constant second) rather than the other that got in the way.

    Comment

    Working...
    X