Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AW: st: Store datafile at minimum possible file size


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   AW: st: Store datafile at minimum possible file size
Date   Fri, 16 Apr 2010 13:27:36 +0200

<> 



*************
zipfile data_boehm.dta, saving(myfiles)
*************

lowers the file size of the resulting archive to 80.7m. So with Stata 11,
Michael does not need any external apps to achieve his goal. 

Note also that a .dta file carries more information than what is dumped into
an ascii file...



HTH
Martin

-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Abdel Rahmen El
Lahga
Gesendet: Freitag, 16. April 2010 13:16
An: statalist@hsphsun2.harvard.edu
Betreff: Re: st: Store datafile at minimum possible file size

In my experience the best solution is to zip immediatlt the stata file
without using ascci format. If we try
************
clear*
set mem 2g
set obs 10000000
gen str12 var1 ="abcdefghijkl"
gen str14 var2 ="abcdefghijklmn"
gen var3 =rnormal()
gen var4 =runiform()
compress
qui save data_boehm , replace
outfile using "ascii_boehm.raw", replace
ls
-rw-r--r--    1 abdelrahmenlahga  staff  550000000 Apr 16 12:05
ascii_boehm.raw
-rw-r--r--    1 abdelrahmenlahga  staff  340000912 Apr 16 12:00
data_boehm.dta
*********
As you can see the ascii file is much bigger than the Stata one.
you can zip it to reduce the file zize to about 85m
HTH
AbdelRahmen

2010/4/16 Michael Boehm <michael.boehm1@gmail.com>:
> Dear statalisters,
>
> I have a big datafile (2 string variables, 2 numeric one, 10million
> observations) created in Stata and want to save it in the smallest
> version possible. I have tried out the "outfile" command to write it
> as an ASCII, but as far as I understand this doesn't give me the
> smallest ASCII file possible. Can anyone help?
>
> Mike
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>



-- 
AbdelRahmen El Lahga

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index