Asign the information of a person inside a household to another person inside the same household

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
daniedusi
Posts: 6
Joined: August 3rd, 2018, 2:24 pm

Asign the information of a person inside a household to another person inside the same household

Post by daniedusi »

How to impute the information of a persons variable inside a household to another person inside the same household?
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Asign the information of a person inside a household to another person inside the same household

Post by josh »

You have to copy the values item by item. If you have each household member as a different record, which is the most common setup for a multi-person household, then you use subscripts to refer to the different household members. So if you want to copy the values from person 3 to person 4 you would do something like:

NAME(4) = NAME(3);
AGE(4) = AGE(3);
SEX(4) = AGE(4);
etc...
where NAME, AGE and SEX are the names of the items in your dictionary.
daniedusi
Posts: 6
Joined: August 3rd, 2018, 2:24 pm

Re: Asign the information of a person inside a household to another person inside the same household

Post by daniedusi »

What i wanted to do is to look in the houshold, when a person lacks some information, impute if someone has it in the household, but if no one in the household has it, impute the nearest neighbor information.
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Asign the information of a person inside a household to another person inside the same household

Post by josh »

That is fairly complicated to implement. If you are a skilled programmer you could do it by looping through the household and checking if any other member has the information you want. Looking at multiple households at once in CSPro is complicated. You would have to open the data file as an external file and use loadcase. Maybe someone else on the forum has implemented this and can give you some guidance.

The more common approach is to use a simple hotdeck technique based on a matrix that you update as you find "good" values in the data file. There is some info on that in the CSPro help: http://www.csprousers.org/help/CSPro/dy ... _deck.html. You can see examples in the CSPro examples folder under "Edits & Batch Programs/Dynamic (Hot Deck) Imputations" and "Edits & Batch Programs/Deck Arrays". The first example is the way we used to implement this imputation technique in CSPro before deck arrays were implemented. The second example performs the same imputation using the deck array feature.
Post Reply