# citing an online database

I have to cite a dataset from World Bank. What I write is the following:

\usepackage{natbib}
\begin{document}
..., Data from \cite{WB2014}.
\bibliographystyle{apa}
\bibliography{mybib}
\end{document}


In mybib.bib file, I have

@misc{WB:2014,
ALTauthor = {The World Bank},
ALTeditor = {},
title = {Life expectancy},
year = {2014},
url = {http://data.worldbank.org/indicator/SP.DYN.LE00.FE.IN},
}


What I get in the main text is:

While it should be "... Data from World Bank (2014)"

and in the reference list I get:

While it should be "Life expectancy, World Bank, (2014), data retrieved from World Development Indicators, http://data.worldbank.org/indicator/SP.DYN.LE00.FE.IN"

Here's a way to get what I believe you're looking for.

\begin{filecontents*}{\jobname.bib}
@preamble{"\DeclareRobustCommand{\firstsecond}[2]{#2}"}

@misc{WB:2014,
author = {{\firstsecond{World Bank}{The World Bank}}},
title = {Life expectancy},
year = {2014},
\url{http://data.worldbank.org/indicator/SP.DYN.LE00.FE.IN}},
}
\end{filecontents*}

\documentclass{article}

\usepackage{natbib}
\usepackage{url}

\DeclareRobustCommand{\firstsecond}[2]{#1}

\begin{document}
Data from \cite{WB:2014}.

\bibliographystyle{apa}
\bibliography{\jobname}

\end{document}


The author field uses a two branch command for sorting and displaying: the first argument is used for sorting in the bibliography and for setting the author name in the text, while the second argument is used for the extended name in the bibliography, where “The World Bank” seems preferable. I use the note field for adding the comment about the retrieval date and the URL.

Note that the filecontents* environment is used just to make the example self-contained.

If you just want that the corporate author is always cited and sorted as “The World Bank”, remove all \firstsecond stuff and input the author field as

author={{The World Bank}},


(with additional braces). If you want that the citation reads “The World Bank (2014)”, type

\DeclareRobustCommand{\firstsecond}[2]{#2}


in both places.