There are many benefits, flexibility, and conveniences for other projects/developers to just continue using context data and using the Analytics processing to do the mapping, as @yuhuisg suggests.
However, to answer your question, it is relatively simple to set the variables directly in custom code (probably within the same rule as the beacon fire):
First, make sure the s object is set globally in the Analytics extension and then write custom code before firing the beacon that appears as the following:
s.propn = s.contextData["exampleDatan"];
s.evarn = s.contextData["moreExampleDatan"];