I would like to set the Household ID code automatically by combining the Province code and District code. How to combine answers from the previous questions?
(numeric) If the Province code is 1 and the District code is 23, the Household ID should come automatically as 123.
(Alphanumeric) If the Province code is A and the District code is 23, the Household ID should come automatically as A23.
For example, if I want to set the Household ID code automatically as the same as the Province code, the logic is:
PROC HOUSEHOLD_ID
Preproc
$ = PROVINCE;
Like this way, how can I preset the answer by combining answers from the previous questions?
Combine answers from previous question.
-
- Posts: 1812
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: Combine answers from previous question.
There are a variety of ways to do this, but here are some examples. You can use arithmetic for simple math combinations:
HOUSEHOLD_ID = PROVINCE * 100 + DISTRICT;
For strings, you can combine variables with maketext:HOUSEHOLD_ID = maketext("%s%02d", PROVINCE, DISTRICT);
Re: Combine answers from previous question.
Thank you.