Daniel Becker

2 software

2.1 deabib.org

http://deabib.org is a website to provide you with bibliographic data about envelopment analysis (DEA). The database – once we have reached version 1.0, currently we are at v0.8.2 – covers more than 5000 papers about DEA that have been published in scientific journals in the years 1950 - 2007 and later.

2.2 epspdfconversion

Becker (2010): epspdfconversion

A LaTeX-package that calls epspdf to convert eps-graphics to pdf. It provides a vehicle for passing conversion options (such as grayscale, prepress or pdfversion) to the epstopdf converter. It is located in /macros/latex/contrib/epspdfconversion at CTAN.

See here for more information and a download-link.

The documentation is here.

2.3 Applescripts for xls/csv files

5.2008 - Applescripts to convert Excel-Datasets in .csv-files and to bring them in a form that is suitable for an import (insheet) in Stata

Here you can find several applescripts that might help you to work with data-files. They are tested on Mac OS X Leopard (10.5).

Open them in the Script-Editor and have a look at the code to understand in full detail what they do. Applescript can also be saved as an application such that a double-click is enough to run them. For sure you need to adjust the first few lines. They are written for a special problem I had with a dataset but for sure can be modified to be helpful in other situations.

You need the application “TextWrangler”. It is available for free at http://www.barebones.com/. M$ Excel is necessary for the first two scripts. Stata is necessary to run the do file.

1_countrycodes.scpt

Takes all files in a folder, opens them with M$ Excel, and adds a column with the filename as an entry. The files are then saved in another folder. In the examle: The names of the original Excel-Files are based on the country-code of the country they contain the data for.

2_xlsTOcsv.scpt

Takes all files in a folder, opens them with M$ Excel, and saves them as .csv-text-files (comma separated values). The files are then saved in another folder.

3_SearchReplace.scpt

Takes all files in a folder, opens them on TextWrangler and runs several search&replace procedures. Some of them use grep-expressions. The files are then saved in another folder.
This is the most useful script and also the one that need the most modifications when applied in other situations. Note that TextWrangler is very “applescriptable” and that you can use the “record”-functionality in the Apple-Script-Editor while working in TextWrangler.

4_merge-sort.scpt

Puts the content of all files in a folder in one file, sorts al lines in this file alphabeticallly and then add a header in line 1 (containing the names of the columns).

5_split.scpt

Takes the file from the last step and splits it in several single-files based on a list given in the script.

X_deleteCSVFiles.scpt

Deletes all files with extension .csv in a folder selected by the user. (Not used in my example.)

stata.do

A stata do-file that reads the .csv-files, converts them into single .dta-datasets and then merges them into one proper stata-dataset.

Example-Dataset

contains all folders and source-files necessary. Unpack the zip-file and save the folder example-data, for example to the Desktop. Check carefully all scripts for line that contain the path to this folder and adjust them accordingly. Run the applescript from 1 to 5. The run the do-file from within Stata.

zip-download Download all scripts and a folder with an example dataset as .zip-file, 228 KB.

2.4 Stata -> LaTeX

   2.4.1 Writing a codebook (compact) as a table that can be used in a LaTeX-document
   2.4.2 Using the stata command tabout to write tables that can be used in a LaTeX-document (TBD)
   2.4.3 Writing a table containing notes from a stata-dataset that can be used in a LaTeX-document (TBD)
   2.4.4 Exporting stata-graphics for use in a LaTeX-document, add annotation (TBD)

semi-official manual: http://www.ats.ucla.edu/stat/stata/latex/default.htm

Important Stata-Commands for producing tables and the like: tabstat, statsmat, tablemat, fsum, tabform, tabout, svytabs, svytabform, mkcorr, corrtab, makematrix, eststo, esttab, outreg2 (findit commandname finds them)

2.4.1 Writing a codebook (compact) as a table that can be used in a LaTeX-document

zip-download Download .zip-file with everything necessary, 116 KB.

Usage:

  1. download the zip-file

  2. open the do-file codebook.do. Read the comments. It is necessary that you adjust a few file-paths and that you use the resulting .tex-file properly.

  3. TeX/Example.tex is a small .tex-file that demonstrates how the resulting file can be used.

Based on ideas from: Gini / Pasquini (2006).

2.4.2 Using the stata command tabout to write tables that can be used in a LaTeX-document (TBD)

TBD - please ask if you need that

2.4.3 Writing a table containing notes from a stata-dataset that can be used in a LaTeX-document (TBD)

TBD - please ask if you need that

2.4.4 Exporting stata-graphics for use in a LaTeX-document, add annotation (TBD)

TBD - please ask if you need that. For the second part, see 2.5.2.

2.5 LaTeX & Co

   2.5.1 epspdfconversion
   2.5.2 add pstricks/LaTeX-code to an eps-graphic
   2.5.3 Links

2.5.1 epspdfconversion

Information about the package epspdfconversion can be found at CTAN.

2.5.2 add pstricks/LaTeX-code to an eps-graphic

Consider you have an eps-graphic file. It could be the result of an export from Stata, MATLAB, Maple or whatever. Sometimes it is necessary to add some notation or additional graphical elements like arrows or boxes.

One way to do that is to use pstricks and/or LaTeX. This is how this can be done

  1. Make your .eps-file part of an \begin{pspicture} ... \end{pspicture}-environment: Create a file my-epsoverlay.tex (or so) that looks like this:

     
    \documentclass{article} 
    \usepackage{graphicx} 
     
           \usepackage{pstricks} 
           \usepackage{pstricks-add} 
           \usepackage{pst-plot} 
           \usepackage{pst-text,pst-node,pst-tree} 
     
    \begin{document} 
    \pagestyle{empty} 
    \newsavebox{\Imagebox} 
    %%%% 
    %%%% HERE: Load the eps-file 
    %%%% 
    \savebox{\Imagebox}{\includegraphics{epsgraph.eps}} 
    \centering 
    %%%% 
    %%%% HERE: add LaTeX/pstricks 
    %%%% 
    \begin{pspicture}(\wd\Imagebox,\ht\Imagebox)% 
    \rput[lb](0,0){\usebox{\Imagebox}} 
    % grid to see coordinates, comment out when done 
    \psgrid[subgriddiv=0,griddots=1,gridlabels=7pt]% 
    (0,0)(\wd\Imagebox,\ht\Imagebox) 
    % Add labels etc here: 
    \rput{0}(5.9,3.9){$b = 1$} 
    \rput{0}(3.4,2.2){$b = 5 $ nicht verwendet} 
    \rput{0}(2.9,1.2){$b = 10 $} 
     
    \rput{0}(0.5,8.1){$k(t)$} 
    \rput{0}(6.7,0.4){$t$} 
    \end{pspicture} 
     
    \end{document}
  2. Add code as in the my-epsoverlay.tex-file.

  3. Then run latex-dvips-ps2pdf13 on that file. In TeXShop, this can be done with an “engine” that looks like that:

    #!/bin/tcsh 
     
    set path= ($path /usr/texbin /usr/local/bin) 
    set filename = "$1" 
    set dviname = "${filename:r}.dvi" 
    set psname = "${filename:r}.ps" 
    set pdfname = "${filename:r}.pdf" 
    set pdfnamebb = "${filename:r}-bb.pdf" 
    set epsnamebb = "${filename:r}.eps" 
    set auxname = "${filename:r}.aux" 
    set logname = "${filename:r}.log" 
     
    # run latex via ghostscript on the tex-file 
    latex --shell-escape "$1" 
    dvips -Ppdf -o "$psname" "$dviname" 
    ps2pdf13 -dAutoRotatePages=/None "$psname" "$pdfname" 
     
    # calculate bounding box 
    epspdf -bb "$pdfname" "$epsnamebb" 
    epspdf -bb "$pdfname" "$pdfnamebb" 
     
     
    # clean up 
    /bin/rm "$pdfname" 
    /bin/rm "$dviname" 
    /bin/rm "$auxname" 
    /bin/rm "$psname" 
    /bin/rm "$logname" 
     
    #rename pictures 
    mv "$pdfnamebb" "$pdfname"

    The code above assumes that the commands latex, dvips, ps2pdf13, /bin/rm, mv and epspdf are available on your system. Especially epspdf is non-standard, you may need to install it separately from your LaTeX-installation. See the documentation of epspdfconversion (2.5.1). If you are using a recent TeXLive-Installation, epspdf is already part of it.

    Other LaTeX-Editors/Frontends may provide other ways to apply the commands on your my-epsoverlay.tex-file.

  4. Now you have two file epsgraph.eps and epsgraph.pdf that can be used in LaTeX oder pdfLaTeX.


PIC PIC
Figure 1: Left: an eps-graphic-file without additional pstricks/LaTeX-code. Right: afterwards. Note that epspdf calculated a proper bounding box.


2.5.3 Links

Last update: October 5, 2021 (19:55)  | This Website as an PDF