I had the same problem, took me a while to find out its cause...
That's correct by the way, that is you must do the SET before the SEND.
Here is the official documentation (see section "Collection"):
[...] Unlike other types of data, custom dimensions and metrics are sent to Google Analytics as parameters attached to other hits, like pageviews, events, or ecommerce transactions. As such, custom dimension or metric values need to be set before a tracking call is made in order for that value to be sent to Google Analytics.
For example, to set a custom dimension value, your code might look like this:
ga('create', 'UA-XXXX-Y', 'auto');
// Set value for custom dimension at index 1.
ga('set', 'dimension1', 'Level 1');
// Send the custom dimension value with a pageview hit.
ga('send', 'pageview');
Cfr. https://support.google.com/analytics/answer/2709828?hl=en