Page 1 of 1

Linking sub-items to records

Posted: January 13th, 2013, 2:52 pm
by Guest
Dear CSPro Users,

I have a questionnaire which has two record types: household-level and person-level. The person level of course has multiple occurrences.

Within the person-level, I want to ask about another multiply occurring item: jobs. So I have multiple people within a household, and then a roster of multiple jobs for every person.

I have solved this by setting the questions on jobs as a multiply occurring sub-item within the person record. This seems to work fine for data entry.

But the problem is when it comes to exporting the data. I can export all the jobs into a "sub-item" database. The problem is that all jobs for a household end up being in the same database, without reference to which person they "belong" to (only the household identifier is stored with every job - but not the sequential person ID). So I end up with a database of all jobs performed by a household, but I loose the information on who did them.

Am I doing something wrong during export? Or is there a way of adding the sequential person ID to the sub-items so I can later link the two?

Thank you very much for any suggestions!

Re: Linking sub-items to records

Posted: January 15th, 2013, 2:28 am
by khurshid.arshad
Dear Guest

If you have on initial stage for data entry then see attached file for modification in data entry program.
Arshad

Re: Linking sub-items to records

Posted: January 15th, 2013, 1:00 pm
by surv
Dear Arshad,

Thank you so much for taking the time to help!

The example file you posted lists all jobs done in a household in a single roster, and requires the interviewer to manually add the PID for every job.
Instead, I am hoping to ask the job roster separately for every person. Please see attached. This looks fine when entering the data.

The problem with this unfortunately seems to be that the jobs, although they are asked as a sub-item within the person record, do not get assigned the sequential PID. So when I export the sub-items into a database, I no longer know which job was done by which person...

Is there a way to solve this?

Many thanks!

Re: Linking sub-items to records

Posted: January 15th, 2013, 1:47 pm
by khurshid.arshad
Dear surv,

If you are getting job information only one person from the roster then add one variable (PID "Personal identification") before age otherwise you can not identify.

If there are more than one person for job information then what will you do? In this regard please use this attached file.

arshad

Re: Linking sub-items to records

Posted: January 17th, 2013, 3:29 pm
by Gregory Martin
Exporting from multiply occurring records with multiply occurring items is quite tricky. If you use the export tool, you essentially have to export the multiply occurring item data separate from the rest of the record. In that case, as you say, you can't determine what person has what job. You can only identify jobs at the household level, not the person level. So, what to do?

One option, that Arshad hints at, is to add some information to the multiply occurring items so that you can link the data later. For example, you could add the PID field to the JOB_ROSTER multiply occurring item, and then in your data entry program's logic you could assign it so that it would be equal to the occurrence number of the person whose data you are entering:
PROC NAME_OF_JOB

preproc

    PID =
curocc(GROUP000);
Alternatively, if you know advanced CSPro, you can create your own batch export program that could export the data to your liking.
    For rec_occ in RECORD PERSON do
        
EXPORT TO file_PERSON
        
CASE_ID(HHID)
        NAME, AGE, GENDER, MARTIAL_STATUS
        NAME_OF_JOB(
1) WORKED_IN_LAST_7_DAYS(1)
        NAME_OF_JOB(
2) WORKED_IN_LAST_7_DAYS(2)
        NAME_OF_JOB(
3) WORKED_IN_LAST_7_DAYS(3)
        NAME_OF_JOB(
4) WORKED_IN_LAST_7_DAYS(4)
        NAME_OF_JOB(
5) WORKED_IN_LAST_7_DAYS(5);
    
Enddo;
This code will export all of the multiply occurring items along with the singly occurring items. See attached for this program.

Re: Linking sub-items to records

Posted: January 22nd, 2013, 7:49 am
by surv
Dear Gregory,
Your two suggestions (exporting in two steps and automatically writing the PID into a protected roster field) helped me solve this problem and it works perfectly.
Thanks so much for your great help!
surv