Computing State from Postcode (Zip Code)

From Q
Jump to navigation Jump to search

In Australia, all addresses have a postcode (i.e., a zip code), which is a four digit number where the first digit identifies the state or territory of residence. If stored as a Text Variable, it could be converted to a categorical variable with the following code:

Math.floor(Q.AsNumeric(state)/1000);

The resulting question should be set to a Question Type of Pick One.