*! version 1.0.0 14jul2026

Title

latinobarometro -- Load, standardize, and enrich a Latinobarometro survey wave

Syntax

latinobarometro, year(#) [options]

Main
year(#) survey year to load (See available years); required

rename rename all variables to standardized cross-year names using the official Latinobarometro time-series crosswalk

addpopulation add World Bank population-based sampling weights at the country level; requires rename

Caching
force ignore any cached files (survey data zip, crosswalk Excel file, population data) and re-download everything fresh

cache(string) override the default cache folder location. The default lives "latinobarometro_cache"

Description

latinobarometro downloads (or reuses a cached copy of) a single year's
Latinobarometro survey wave, loads the English-language .dta file,
sanitizes variable names and value-label names that are invalid in Stata
(accented/Unicode characters and periods), and optionally:

1. renames every variable to a standardized name that is consistent
across survey years, using the official Latinobarometro "Serie de
Tiempo" crosswalk file, and

2. merges in World Bank total-population data by country and
constructs a population-based sampling weight (wt_lac) suitable
for pooled cross-country analysis.

All downloaded files (survey zips, the crosswalk Excel file, and the
World Bank population extract) are cached locally so that repeated
calls to latinobarometro do not require re-downloading. Use the
force option to bypass the cache and fetch fresh copies.

This program only downloads from latinobarometro.org. There is
deliberately no fallback mirror: Latinobarometro's own terms of use
prohibit republishing their data on other websites, so no alternate
source is built in. If latinobarometro.org is temporarily unreachable,
latinobarometro will report a clear download error rather than
silently substituting another source. The local cache still means any
year you have already successfully loaded once remains available
offline indefinitely, regardless of the site's availability.

Options

Main

year(#) specifies the four-digit survey year to load, e.g.
year(2020). This option is required. The year must be one
covered by the internal year-to-URL lookup table (1995-2018, 2020,
2023, 2024 at the time of writing); years not yet added to the table
will produce an error directing you to update it.

rename renames every matched variable from its raw, year-specific
name (e.g. P12STGBS in the 2020 file) to a standardized name that
is stable across years (e.g. A_001_001), and attaches the
corresponding English variable label. Renaming is driven entirely by
the official Latinobarometro crosswalk file (xlsx), downloaded and cached
automatically; no local copy needs to be supplied by the user. Only
variables with a non-missing mapping for the requested year are
renamed; everything else is left untouched.

addpopulation adds two country-level variables constructed from
World Bank population data (sp.pop.totl): total_sample
(the sample size collected in that country) and wt_lac (a
weight rescaling the sample to be proportional to each country's
actual population. Use with proper weight and survey optins). This option requires
rename to have already been specified in the same call, since it
depends on the standardized X_001 (country code) and
X_020 (original sample weight) variables that only exist after
renaming.

Caching

force ignores every cache (the survey-year zip, the crosswalk
Excel file, and the population extract, as applicable to the options
specified) and re-downloads all of them fresh. Use this if you suspect
Latinobarometro has updated a file, or if a cached file appears
corrupted.

cache(string) overrides the default folder used to store all
cached downloads. If not specified, files are cached to a fixed
default path ("`c(sysdir_personal)'latinobarometro_cache/year").
The folder is created automatically if it does not already exist.

Remarks

latinobarometro loads exactly one survey year per call. To build a
pooled panel across multiple years, call latinobarometro in a loop,
save or append the result after each call, and use
rename (and typically addpopulation) consistently across
all years so that variable names line up. For example:

. tempfile all

. latinobarometro, year(2007) rename addpopulation local

. save `all', replace

. foreach y of numlist 2008/2020 {

. capture latinobarometro, year(`y') rename addpopulation local

. if !_rc {

. append using `all'

. save `all', replace

. }

. }

Wrapping each call in capture is recommended when looping over a
range of years, since not every year in the range is necessarily a
survey year (e.g. 2012, 2014, 2019 do not exist), and the year lookup
table may not yet cover every year you request.

The variable-name and value-label sanitization steps run unconditionally
on every call, regardless of whether rename is specified, since
some years' raw files contain variable names or value-label names with
characters that are not valid in Stata (in particular, periods, which
caused certain years to fail to load prior to this fix).

Examples

Load a single year with no further processing

. latinobarometro, year(2018)

Load a year and standardize variable names

. latinobarometro, year(2018) rename

Load a year, standardize variable names, and add population weights

. latinobarometro, year(2018) rename addpopulation

Force a fresh re-download of everything for this year, bypassing all caches

. latinobarometro, year(2020) rename addpopulation force

Use a custom cache folder

. latinobarometro, year(2020) rename cache("/Users/me/Desktop/lb_cache")

Stored results

latinobarometro does not leave behind any r() or e() results.
Its output is the loaded-and-processed dataset itself, left in memory
after the command completes, exactly as use would.

Issues

latinobarometro uses the official Excel crosswalk file to rename the variables of each survey wave in order to have a harmonized multiple-year database. This harmonization is not free from errors, for example, multiple coded answers that are not specifically labeled in the Excel are not rename. For example, The variable for the Social Network Services used is P83TNC_? where ? represents a different social network. Since the Excel file doesn't list every social network, the renamed file will still have the year-specific same (P83TNC_?), not the harmonized one (E_003_001). Currently, the issue is being considered.

LAC wide weights wt_lac should be used with caution. Latinobarometro typically covers 18+ respondents, and each country has it's own survey design, so pooling should respond to specific work.

Author

Jorge Soler-Lopez

jorge.solerlopez@phd.unibocconi.it

Bocconi University

Citations & Usage

As per Latinobarometro all datasets are available for non-commercial research, teaching, and publications.
Cite as follows (changing for the year that is used):

Latinobarómetro Study 2023. Latinobarómetro Corporation: 2023 Wave – Aggregated Version: https://www.latinobarometro.org/latinobarometro-2023. Madrid: JD Systems Institute.