LTSPICE P-Channel MOSFET
Shouldn't this work as a switch, meaning that the voltage should go between roughly 0 and roughly 20, not 19.898 and 19.895?


If you want to switch the PMOS off, you need to drive the gate very close to the source. So you need the pulse amplitude to be ~20 V, rather than 5 V. 

As it is, you are only testing the difference between the transistor being very strongly "on" (\$V_{gs}=-20\ V\$) and being just slightly less strongly on (\$V_{gs}=-15\ V\$). 

To put the MOSFET into cut-off mode, you want \$V_{gs} &gt; -0.3\ V\$ (based on the datasheet minimum \$V_{gs}({\rm th})\$).