user16176: You can right click on a scale, hit Edit, and then enter scale in Pixels, inches , % of Comp, of source.... 
I would like to set the scale in pixels. How can set the units using expressions?
I tried returning ["200px","200px"], but that is an error.

user1950: The size in pixels is easily computed as the source's original dimensions multiplied by the scale. Or in other words 
p = d × s

where p=pixel dimensions required, d=source dimensions, s=scale.
So to set the scale so that it takes a given source and makes it conform to a desired dimensions:
s = p / d

In an expression on the scale property you'd use
var p = [123, 456]; / desired output dimension
[ p[0] / width, p[1] / height ] * 100; // the *100 is because scale is a percentage

To be really fancy you could repurpose the scale value input so that it controlled the pixel dimensions. This means if you want the layer's dimension to be [123,456] you'd just dial it in in the scale control:
var d = value; //returns the pre-expression value of the property
[ p[0] / width, p[1] / height ] * 100


16176: <p>You can right click on a scale, hit Edit, and then enter scale in Pixels, inches , % of Comp, of source.... </p>

<p>I would like to set the scale in pixels. How can set the units using expressions?</p>

<p>I tried returning <code>["200px","200px"]</code>, but that is an error.</p>
 1950: <p>The size in pixels is easily computed as the source's original dimensions multiplied by the scale. Or in other words </p>

<pre><code>p = d × s
</code></pre>

<p>where p=pixel dimensions required, d=source dimensions, s=scale.</p>

<p>So to set the scale so that it takes a given source and makes it conform to a desired dimensions:</p>

<pre><code>s = p / d
</code></pre>

<p>In an expression on the scale property you'd use</p>

<pre><code>var p = [123, 456]; / desired output dimension
[ p[0] / width, p[1] / height ] * 100; // the *100 is because scale is a percentage
</code></pre>

<p>To be really fancy you could repurpose the scale value input so that it controlled the pixel dimensions. This means if you want the layer's dimension to be [123,456] you'd just dial it in in the scale control:</p>

<pre><code>var d = value; //returns the pre-expression value of the property
[ p[0] / width, p[1] / height ] * 100
</code></pre>
