Can I simply use the same switch loop technique as with a light?
in combination with this:
replacing the light with the final outlet?
Home Improvement Stack Exchange is a question and answer site for contractors and serious DIYers. It only takes a minute to sign up.Sign up to join this community
Yes, you can wire it like this...
Notice that the white wire between the boxes has been repurposed, and is marked at both terminals to indicate this.
If you wanted a half-switched receptacle, you could do this...
As long as you remove the tab between the hot terminals, there should be no problems.
Just remember to always interrupt the ungrounded (hot) conductor with the switch, not the grounded (neutral) conductor.
NOTE: If you're following current codes, and this is a new install. A grounded (neutral) conductor is now required at each switch location, so this would no longer be possible without an additional conductor.
Only if you either have only one outlet or have 3 conductors all the way between the feed and the switch. Notice in your top diagram that there isn't a neutral going to the switch - it is being used as a switched hot. If you have more than one outlet, you need to find a way to get a neutral beyond the first one. See below - ground and boxes omitted for clarity (feed is from the left):
If there is only one outlet between the feed and the switch, you just wire it like your top diagram with the outlet as the "light".
I'd tend to go with @Tester101's note, rather than what's electrically possible but does not meet current codes (whether for switching lights or outlets.) While you will find the switch loop without neutral technique in old wiring, so it's good to be aware of, it's no longer acceptable (because codes are adapting to make way for smarter switches that may need a neutral conductor at the switch) so you should not install one that way, now.
Take @Comintern's diagram, delete the white wire with black tape, extend the red wire all the way to the switch, and extend the white wire on the bottom to the switch. Then you are good by current codes.