Project

General

Profile

Support #1172

seeming errors in fnspid and mnspid variables

Added by Katy Morris about 5 years ago. Updated almost 5 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Start date:
03/26/2019
% Done:

70%


Description

Hello,

I am trying to match parents and children in UKHLS (using via pidp, fnspid and mnspid variables) and obtain a peculiar error when doing so in Stata.

Having merged all waves, I'm using the egen command in order to pick up any parents who are not identified in the wave the respondent enters UKHLS, as follows:

egen fpidp=max(fnspid), by (pidp)
format fpidp %12.0g

Unfortunately this generates incorrect data, for example pipd 29925, whose father is officially fnspid 614482685 somehow becomes 614482688 using the above syntax. This is one of many, many errors that I can see. Having tried to find ways around this, it turns out that clonevar clones the variable correctly but is vulnerable to the same error when egen is subsequently used. A simple gen fpidp= fnspid produces the same (mostly wrong) values as the egen procedure outlined above.

I find this very puzzling - is it a Stata error? Grateful for all and any advice on how to proceed.

Katy

#1

Updated by Alita Nandi about 5 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 70

USE

egen long fpidp=max(fnspid), by (pidp)

INSTEAD OF

egen fpidp=max(fnspid), by (pidp)

Best wishes,
Alita

#2

Updated by Alita Nandi about 5 years ago

  • Assignee set to Katy Morris
#3

Updated by Alita Nandi about 5 years ago

  • Private changed from Yes to No
#4

Updated by Katy Morris about 5 years ago

Alita Nandi wrote:

USE

egen long fpidp=max(fnspid), by (pidp)

INSTEAD OF

egen fpidp=max(fnspid), by (pidp)

Best wishes,
Alita

Problem solved - thank you!

#5

Updated by Alita Nandi about 5 years ago

  • Status changed from In Progress to Resolved

Also available in: Atom PDF