Hi!
How to find the third one and changed it to 4?(without loop ?Is it possible?)
Generally How may I get the nth repetitive element (1,2or 3) from set A and change it?Is there anyway to do that?

Set A/1*9/;
Parameter c(A);
*Suppose p is c(A)=121311332
c(A) /1 1,2 2,3 1,4 3,5 1,6 1,7 3,8 3,9 2/;
*===========
*(E.g. 121311332 changed to 121341332

You can build up a set pos(p,x,a) that gives you the location a (in your vector) for the xth occurrence of the number p and with that you easily access the location of the ith location of a value. If you change c then the set pos becomes outdated and needs to be recalculated. So I you you just access a single ith occurrence of a value to just change it then this is not much of a help over the trivial solution (implemented in macro change). This pos-solution assumes that the values of c come from small set (I used an alias to A). Anyway, here is the code.