Linking sub-items to records

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
Guest

Linking sub-items to records

Post 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!
khurshid.arshad
Posts: 571
Joined: July 9th, 2012, 11:32 am
Location: Islamabad, Pakistan

Re: Linking sub-items to records

Post 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
Attachments
Employment.rar
(4.85 KiB) Downloaded 549 times
surv
Posts: 2
Joined: January 15th, 2013, 12:46 pm

Re: Linking sub-items to records

Post 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!
Attachments
Employment2.zip
(3.78 KiB) Downloaded 463 times
khurshid.arshad
Posts: 571
Joined: July 9th, 2012, 11:32 am
Location: Islamabad, Pakistan

Re: Linking sub-items to records

Post 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
Attachments
Employment.rar
(4.72 KiB) Downloaded 437 times
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Linking sub-items to records

Post 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.
Attachments
employmentExport.zip
(2.84 KiB) Downloaded 461 times
surv
Posts: 2
Joined: January 15th, 2013, 12:46 pm

Re: Linking sub-items to records

Post 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
Post Reply