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
multilevel modelling - syntaxHello, How are the two following lines of code different in the way they treat the cluster variable…
Panel Data with Count DV - CEM & Diff-in-Diff & NBREGHello! In my dataset, I'm looking to model the effect of a particular treatment on the number of pa…
graph estimated coefficients after oaxaca_rif commandDear all, I use oaxaca_rif user written command by Rios-Avila (Rios-Avila, F. 2020. Recentered infl…
Foreach recodeHello. Sorry, if my question seems stupid to you, im fairly new to stata and cant seem to figure out…
Error "pweights must be positive"Hi Statalists, I keeps getting an error message, ""pweights must be positive", when using the "mixe…
Subscribe to:
Post Comments (Atom)
0 Response to format of numeric IDs for merger
Post a Comment