Hi
I want to a write external data case file from a roster data as a single case file. Anyone please share the example.
Thanks in advance.
PP
Write Case Function
-
- Posts: 1792
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: Write Case Function
You'll have to add more details if you want someone to post an example that is useful. Perhaps you can post your dictionaries and indicate what you are trying to do.
Writecase simply saves what is loaded into your variables, so you will want to execute some logic commands to get the right data into memory. For example, if I had a roster with two variables, SEX and AGE, and I wanted to save separate cases for each person, my code might look like this:
Writecase simply saves what is loaded into your variables, so you will want to execute some logic commands to get the right data into memory. For example, if I had a roster with two variables, SEX and AGE, and I wanted to save separate cases for each person, my code might look like this:
do numeric counter = 1 while counter <= count(SEX)
EXT_DICT_HHID = HHID;
EXT_DICT_PERSON_ID = counter;
EXT_DICT_SEX = SEX(counter);
EXT_DICT_AGE = AGE(counter);
writecase(EXT_DICT_AGE);
enddo;
EXT_DICT_HHID = HHID;
EXT_DICT_PERSON_ID = counter;
EXT_DICT_SEX = SEX(counter);
EXT_DICT_AGE = AGE(counter);
writecase(EXT_DICT_AGE);
enddo;