In programming, set X to v is a common idiom to mean changing the value of X to become v. Here's an example:
The Set X to () block is a Motion block and a Stack block. The block changes its sprite's X position by the specified amount. - Scratch Progrmaming Wiki
The form set X as v is not as familiar to me, but it does occur and can be understood the same way. However, it can also be (and arguably, is naturally) understood in the opposite way. In the following example, X is used as the CAS variable (i.e. like set CAS to x):
For Part 6, we will use X as the CAS variable. ...
To set X as the CAS variable ... - Eddie's Math and Calculator Blog
The form set X v is ungrammatical. In scholarly work, it would require prior agreement / definition of the convention.
Here's another form you could try:
Let X = v.
This form is unambiguous and is commonly used in mathematics and mathematical publications, and it is idiomatic among programmers.