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
Graphic legend includes empty categories?Greetings! Is there a way to force a pie graph legend to include categories that are empty? For exam…
How to extract rar files with stata?How to extract rar files with stata?For example,I can use unzipfile to extract the zip file.What* ab…
Gini coefficientHello Excuse ، I have the income data and the number of people in each household and the weight of h…
How to extract rar files with stata?How to extract rar files with stata?For example,I can use unzipfile to extract the zip file.What abo…
create individual identifiers numbered from 0 upwardsHi, I need to create a new variable "ID" from a existing variable "Value", i have been trying with …
Subscribe to:
Post Comments (Atom)
0 Response to format of numeric IDs for merger
Post a Comment