Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Sergiy Radyakin <serjradyakin@gmail.com> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | Re: st: statamod fortran library |
Date | Fri, 8 Nov 2013 21:47:44 -0500 |
Daniel, 1) GNU Fortran compiler lists FSEEK as supported. No personal experience. Description and example program here: http://gcc.gnu.org/onlinedocs/gfortran/FSEEK.html 2) For Stata 11 file you don't need to seek within the file at all (in Stata 13 you do). All structures are of known size and you can read them into memory one by one, without repositioning or jumping in the file, but simply using the read statement, see e.g. how it is done in line 627 of statamod.f90. The only thing I can imagine is that Fortran holds arrays differently from e.g. C, but you should abstract that, since the library is probably reading the file element by element, and not overlaying native Fortran structures on top of the file data. 3) You can read the whole file into memory (subject to reasonable considerations of file size vs memory size). Then stream from the memory. In that case you can manipulate the pointers any way you like. 4) Seeing the message "strings not supported" tells me that there are probably some serious limitations in this library. Perhaps consider the examples in the Mata file io section. It is shown how to use mata to write a numeric matrix into a file in your own format, which you can then easily read with external program (e.g. your FORTRAN consumer). You sacrifice some features as value/variable labels, etc. 5) This is definitely a FORTRAN question. You might get more concrete solutions in one of the FORTRAN forums. Also look at this book: http://www.springer.com/statistics/computational+statistics/book/978-0-387-23817-3 Best, Sergiy Radyakin On Fri, Nov 8, 2013 at 8:00 PM, Daniel Feenberg <feenberg@nber.org> wrote: > Has anyone had experience compiling the statamod library for > reading and writing Stata .dta files (through version 11 only) > with other than the Intel compiler? The library uses the > non-standard ipfort module, but apparently only for fseek. Here > is a link to the library source: > > http://www.sas.upenn.edu/~asheph/software.htm > > Is there another source for this ability? > > Daniel Feenberg > NBER > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/