Hi, all, I have trouble with some IDs before (and after..) a merger.
I want to 'mirror' and ID variable, so I can later have the same name across several files (MRNs), yet still preserve the initial ones.
So I generate a new variable
gen MRNs = iddrug
which shows this:
iddrug MRNs
134217752 1.34e+08
134217781 1.34e+08
134217786 1.34e+08
134217821 1.34e+08
The initial one has:
Type: long
Format: %12.0g
whereas the new one comes out as:
Type: float
Format: %9.0g
So: wouldn't the new one be expected to take on all the characteristics of the original variable?
If I try to revert its format with
format %12.0g MRNs
the numbers get 'scrambled':
iddrug MRNs
134217752 134217760
134217781 134217776
134217786 134217792
134217821 134217824
Any guess why this happens and how to 'fix' it?
Update before posting: I read some older posts and saw an option to generate this new one instead using
gen byte MRNs
replace MRNs=iddrug
which makes it come out as
Type: long
Format: %8.0g
and then with a
format %12.0g MRNs
seems to give me the right/same numbers:
iddrug MRNs
134217752 134217752
134217781 134217781
134217786 134217786
134217821 134217821
So: the remaining issue is why would gen mess up things in the first place (I need to watch my back from now on any time I use it... which isn't quite comforting).
Thanks, Emil
Related Posts with format of numeric IDs for merger
Subjects with no failure event not in risk pool, StsetHello- I am using the following commands for my set of patients with multiple records and multiple …
Interaction Term with dummy and continuous variable!Hello all, I have a silly question regarding interaction term. Would appreciate prompt input :-) T…
Margins after xtlogit, feDear Statalist: I am trying to verify something about the -margins- command after xtlogit, fe. When…
Problems with the Esttab commandDear Stata community, I have currently an issue with the esttab command. I want to run a loop of re…
Problems with the Esttab commandDear Stata community, I have currently an issue with the esttab command. I want to run a loop of re…
Subscribe to:
Post Comments (Atom)
0 Response to format of numeric IDs for merger
Post a Comment