Advised by Christophe, I created this new post for Statlisters' wishes for Stata 15. Feel free to drop your wishes here. Hope that our discussions here can make Stata/Mata a more user-friendly software.
Ingrid
Ingrid
use event.dta, clear use person.dta, background("person") ** ^ leaves event.dta as the "current" data, but reads in person.dta in the "background", storing it with label "person" ds ** event_id date location ds, using("person") ** person_id age gender location tab gender, using("person") br, using("person") merge m:m location using_bk("person"), gen_bk("person_event") ** ^ creates "person_event" table in memory in the "background", leaving currently loaded data alone use_bk "person", switch("event") ** ^ takes table "person" from the background as the current data, puts current data into background as "event"
# R object containing reference to the auto data set for comparisons autoin <- "/Applications/Stata/ado/base/a/auto.dta" # Read with Haven autoHaven <- haven::read_dta(autoin) # Write out separate versions of the files to further test foreign::write.dta(autoHaven, "/Applications/Stata/ado/base/a/autoforeign.dta") haven::write_dta(autoHaven, "/Applications/Stata/ado/base/a/autohaven.dta")
foreach i in auto.dta autoStatTransfer.dta autoforeign.dta autohaven.dta { di `"File `i' Hexadecimal Dump: "' hexdump `i', analyze } File auto.dta Hexadecimal Dump: Line-end characters Line length (tab=1) \r\n (Windows) 0 minimum 2 \r by itself (Mac) 13 maximum 3,180 \n by itself (Unix) 19 Space/separator characters Number of lines 32 [blank] 132 EOL at EOF? yes [tab] 8 [comma] (,) 5 Length of first 5 lines Control characters Line 1 3,180 binary 0 2,816 Line 2 42 CTL excl. \r, \n, \t 531 Line 3 168 DEL 17 Line 4 129 Extended (128-159,255) 133 Line 5 3 ASCII printable A-Z 306 a-z 1,464 File format BINARY 0-9 143 Special (!@#$ etc.) 565 Extended (160-254) 304 --------------- Total 6,443 Observed were: \0 ^A ^B ^C ^D ^E ^F ^G ^H \t \n ^K ^L \r ^N ^O ^P ^Q ^R ^S ^T ^U ^V ^W ^X ^Y ^Z Esc 28 29 30 31 blank ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P R S T U V W X Y Z [ \ ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { } DEL 128 E^B E^C E^D E^E E^F E^H E^J E^L E^M E^N E^O E^P E^R E^S E^T E^U E^V E^W E^X E^Y E^Z 155 156 157 159 160 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 255 File autoStatTransfer.dta Hexadecimal Dump: Line-end characters Line length (tab=1) \r\n (Windows) 0 minimum 1 \r by itself (Mac) 20 maximum 3,090 \n by itself (Unix) 29 Space/separator characters Number of lines 50 [blank] 120 EOL at EOF? no [tab] 15 [comma] (,) 5 Length of first 5 lines Control characters Line 1 71 binary 0 2,996 Line 2 3,090 CTL excl. \r, \n, \t 508 Line 3 43 DEL 4 Line 4 141 Extended (128-159,255) 192 Line 5 31 ASCII printable A-Z 257 a-z 1,150 File format BINARY 0-9 308 Special (!@#$ etc.) 539 Extended (160-254) 283 --------------- Total 6,406 Observed were: \0 ^A ^B ^C ^D ^E ^F ^G ^H \t \n ^K ^L \r ^N ^O ^P ^Q ^R ^S ^T ^U ^V ^W ^X ^Y ^Z Esc 28 29 30 31 blank ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z } DEL 128 E^B E^C E^D E^E E^F E^H E^J E^L E^M E^N E^O E^P E^R E^S E^T E^U E^W E^X E^Y E^Z 155 156 157 159 160 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 255 File autoforeign.dta Hexadecimal Dump: Line-end characters Line length (tab=1) \r\n (Windows) 0 minimum 2 \r by itself (Mac) 19 maximum 2,172 \n by itself (Unix) 29 Space/separator characters Number of lines 49 [blank] 103 EOL at EOF? no [tab] 11 [comma] (,) 5 Length of first 5 lines Control characters Line 1 2,172 binary 0 4,759 Line 2 68 CTL excl. \r, \n, \t 519 Line 3 225 DEL 5 Line 4 44 Extended (128-159,255) 84 Line 5 207 ASCII printable A-Z 196 a-z 807 File format BINARY 0-9 70 Special (!@#$ etc.) 344 Extended (160-254) 234 --------------- Total 7,166 Observed were: \0 ^A ^B ^C ^D ^E ^F ^G ^H \t \n ^K ^L \r ^N ^O ^P ^Q ^R ^S ^T ^U ^V ^W ^X ^Y ^Z Esc 28 29 30 31 blank ! " # $ % & ' ( ) * + , - . 0 1 2 3 4 5 6 7 8 9 < = > ? @ A B C D E F G H I J L M N O P Q R S T U V W X Y Z [ \ ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z } DEL 128 E^B E^C E^D E^E E^F E^H E^J E^L E^M E^N E^O E^P E^R E^S E^T E^U E^W E^X E^Y E^Z 155 156 157 159 160 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 255 File autohaven.dta Hexadecimal Dump: Line-end characters Line length (tab=1) \r\n (Windows) 0 minimum 2 \r by itself (Mac) 19 maximum 2,172 \n by itself (Unix) 29 Space/separator characters Number of lines 49 [blank] 108 EOL at EOF? no [tab] 12 [comma] (,) 5 Length of first 5 lines Control characters Line 1 2,172 binary 0 4,782 Line 2 68 CTL excl. \r, \n, \t 523 Line 3 225 DEL 5 Line 4 44 Extended (128-159,255) 80 Line 5 207 ASCII printable A-Z 213 a-z 841 File format BINARY 0-9 58 Special (!@#$ etc.) 343 Extended (160-254) 248 --------------- Total 7,247 Observed were: \0 ^A ^B ^C ^D ^E ^F ^G ^H \t \n ^K ^L \r ^N ^O ^P ^Q ^R ^S ^T ^U ^V ^W ^X ^Y ^Z Esc 28 29 30 31 blank ! " # $ % & ' ( ) * + , - . 0 1 2 3 4 5 6 7 8 9 : < = > ? @ A B C D E F G H I J L M N O P Q R S T U V W X Y Z [ \ ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z } DEL 128 E^B E^C E^D E^E E^F E^H E^J E^L E^M E^N E^O E^P E^R E^S E^T E^U E^W E^X E^Y E^Z 155 156 157 159 160 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 255
help dta
Comment