Announcement

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

  • Help writing a mata function

    Hello, I need help writing a Mata function that selects all elements from a vector which are larger than 10 and then multiplies every third element of the resulting vector (e.g. if the vector is x={11,2,41,70,5,60,100,22}, the resulting vector is y={11,41,70,60,100,22} and the function should calculate the solution of 70*22). The function should display both the resulting vector (i.e. the vector only containing values larger than 10) and the calculated product. The product should also be returned at the end of the function. Its quite a challenge and any help would be appreciated.

    Best regards,
    Juan

  • #2
    See the discussion at https://www.statalist.org/forums/for...55#post1470955

    Comment

    Working...
    X