*! version 1.1.4 june242026

help for lodes

Title

lodes -- Command to obtain and process US Census Longitudinal Employer-Household Dynamics
(LEHD)
Origin-Destination Employment Statistics
(LODES) data.

Syntax

lodes subcommand [...]

subcommand

get Imports a LODES data file (i.e., od, wac, rac) for a specified state, along with its respective geography crosswalk file into Stata frames.

destination Performs data analysis mirroring what can be manually done using the using the OnTheMap web-based tool by running Destination Analysis.

inflow_outflow Performs data analysis mirroring what can be manually done using the OnTheMap web-based tool by running Inflow-Outflow Analysis.

area_profile Performs data analysis mirroring what can be manually done using the OnTheMap web-based tool by running Area Profile Analysis.

Description

lodes imports and processes LEHD LODES data, mirroring the analysis
that can be manually done using the
OnTheMap web-based tool.
lodes eliminates the manual steps required by the online tool, with
the added value of running within the Stata environment. lodes can
use ESRI
shapefiles to define a custom geographic area of interest to selectively
obtain data and run analysis.

Requirements

lodes relies on the following user-written packages. If any are
missing when lodes get is run, the command stops with a clear
message listing the install commands; install the missing packages and
re-run. (Earlier versions installed dependencies silently; this is now
the user's choice so nothing is added to your ado-path without consent.)

• fframeappend (SSC) - appends frames row-wise.

Install with: . ssc install fframeappend

• geoinpoly (SSC) - tests point-in-polygon for shapefile
polygons.

Install with: . ssc install geoinpoly

• gzimport (not on SSC) - reads gzipped delimited files
directly. Author: M. Droste.

Install with: . net install gzimport, from(https://raw.githubusercontent.com/mdroste/stata-gzimport/master/)

lodes also requires Stata 16.1 or later (for native frame support)
and an active Internet connection to retrieve LODES CSV files from the
U.S. Census LEHD server.

lodes get

Syntax

lodes get state [, options]

Imports data for an entire state and for a minimum of one year. Data are
provided at the block level and can be aggregated at different geography
levels using the corresponding geography reference file. See LODES
Dataset Structure documentation
for the detailed description of datasets. The data file and crosswalk
reference file are set up as Stata frames.

state – a string representing a state abbreviation (e.g., fl or FL).

data_type – a string representing the LODES dataset type to be imported:

• OD – Origin-Destination data, job totals are associated with both a home Census Block and work Census Block.

• RAC – Residence Area Characteristics data, jobs are summed at the home Census Block.

• WAC – Workplace Area Characteristics data, jobs are summed at the work Census Block.

If the user does not specify data_type, the default is OD.
Note: the segment option below applies only to WAC and
RAC data and is ignored (with a notice) for OD, whose CSV
files are not segmented.

job_type - A string defining the job type, which can be any of the following:

• JT00 – All jobs

• JT01 – Primary jobs

• JT02 – All private jobs

• JT03 – All private primary jobs

• JT04 – All federal jobs

• JT05 – Federal primary jobs

If the user does not specify job_type, the default JT00 – All jobs is used.

segment – a string defining jobs by either age (SA--), earning
(SE--), or industry sector (SI--). Only applies to WAC and RAC
data; the option is ignored (with a notice) for OD, whose CSV files
are not segmented. When using WAC or RAC, the default is
S000 (Total Number of Jobs).

year – a string indicating the year or years of data to be imported.
Multiple years can be indicated. If the user does not specify a value, the
default lates data release is used. Note that for some states some years are
unavailable (see:
OnTheMap Data Overview).

od_part – this string defines which part of the OD file to include.
The main part includes jobs with both workplace and residence in the
state and the aux part includes jobs with the workplace in the state
and the residence outside the state. The default is both part files
(main and aux).

lodes_version – this string specifies which release of the LODES dataset to import. The default is LODES8.

clear – allow lodes get to overwrite its output frames if they
already exist in memory (typically from a previous lodes get run).
The output frames are the state crosswalk (e.g., fl_xwalk) and the
main data frame (e.g., fl_od_JT00). Without clear, the command
aborts with an error rather than overwriting. Other frames in memory are
never affected in either case; this option is safe to use even with
unrelated frames open. lodes get no longer drops the user's default
frame, so any data loaded before the call is preserved.

saveas – save output as a Stata dataset.

replace – if saveas() is specified, overwrite the existing files.

saveframes – if saveas() is specified, save the imported data as a Stata frame. This option saves two data frames,
the main data imported for analysis (e.g., od) and the selected state geography cross walk frame (e.g., fl_xwalk).

deleteframe – remove the generated output frames.

browse – browse the output data frame.

lodes destination

Syntax

lodes destination geography [, options]

Performs origin-destination analysis that replicates what
OnTheMap
does when running Analysis Type: Destination. It uses the OD
dataset and provides a full analysis of either where workers residing in
a given area go to work (home), or a full analysis of where workers
come from to work in a specific area (work). Note: you must
first import data using the lodes get command and OD
data_type.

geography – this string specifies the name of the geography of origin. One of the following geographies can be selected:

• bgrp – US Census Block Group

• trct – US Census Tract

• zcta – US Census Zip Code Tabulation Area

• cty – US County

• stplc – US Census Place

• cbsa – US Census Combined Statistical Area

• cty – US County

• st – US State

• polygon - custom shapefile polygon

polygon represents the name of the zipped file containing the ESRI shapefile defining a polygon that must be supplied.

shapedir – this string must be supplied if the oname geography is polygon. It points the directory where the ESRI zipped shapefile is located.

origin – By specifying home, it means you are analyzing where resident workers in the selected geography go to work.
By specifying work, it means you are analyzing where workers working in the selected geography reside.
The default is home.

dname – geography of destination. Can be any of the geographies listed above.

oname_id – This string allows selecting to retain output only for a specific geography id.

top_loc – This string allows selecting to retain only the top x output locations ranked by number of jobs by job type.

saveas – save output as a Stata dataset.

exportexcel – if saveas() is specified, export output to an Excel spreadsheet.

replace – if saveas() is specified, overwrite the existing files.

saveframes – if saveas() is specified, save the imported data as a Stata frame.
This option saves two data frames, the main data imported for analysis (e.g., od)
and the selected state geography cross walk frame (e.g., fl_xwalk).

deleteframe – remove the generated output frames.

browse – browse the output data frame.

lodes inflow_outflow

Syntax

lodes inflow-outflow geography [, options]

Performs origin-destination analysis that replicates what
OnTheMap
does when running Analysis Type: Destination. It uses the OD dataset
and provides a full analysis of either where workers residing in a given
area go to work (home) or a full analysis of where workers come from to
work in a specific area (work). Note: you must first import data
using the lodes get command and OD data_type.

geography – this string specifies the name of the geography of reference. One of the following geographies can be selected:

• bgrp – US Census Block Group

• trct – US Census Tract

• zcta – US Census Zip Code Tabulation Area

• cty – US County

• stplc – US Census Place

• cbsa – US Census Combined Statistical Area

• cty – US County

• st – US State

• polygon - custom shapefile polygon

polygon represents the name of the zipped file containing the ESRI shapefile defining a polygon that must be supplied.

shapedir – this string must be supplied if the oname geography is polygon. It points the directory where the ESRI zipped shapefile is located.

geo_id - This string allows selecting to retain output only for a specific geography id. When using a shapefile polygon,
this feature is automatically activated to retain only data for the polygon.

work_seg - this string specifies which job cohorts or types. Following the LODES Technical Documentation, the analysis can be done for the following job cohorts/types:

• S000 – Total number of jobs

• SA01 – Number of jobs of workers age 29 or younger

• SA02 – Number of jobs for workers age 30 to 54

• SA03 – Number of jobs for workers age 55 or older

• SE01 – UNumber of jobs with earnings $1250/month or less

• SE02 – Number of jobs with earnings $1251/month to $3333/month

• SE03 – Number of jobs with earnings greater than $3333/month

• SI01 – Number of jobs in Goods Producing industry sectors

• SI02 – Number of jobs in Trade, Transportation, and Utilities industry sectors

• SI03 – Number of jobs in All Other Services industry sectors

saveas – save output as a Stata dataset.

exportexcel – if saveas() is specified, export output to an Excel spreadsheet.

replace – if saveas() is specified, overwrite the existing files.

saveframes – if saveas() is specified, save the imported data as a Stata frame.
This option saves two data frames, the main data imported for analysis (e.g., od)
and the selected state geography cross walk frame (e.g., fl_xwalk).

deleteframe – remove the generated output frames.

browse – browse the output data frame.

lodes area_profile

Syntax

lodes area_profile geography [, options]

Performs detailed profile analysis of any geographic area, replicating
what OnTheMap does when
running Analysis Type: Area Analysis. It uses either the WAC or
RAC datasets and provides a full profile analysis based on either
where workers reside (WAC), or where they work (RAC) in the
selected geography.

geography – this string specifies the name of the geography of reference. One of the following geographies can be selected:

• bgrp – US Census Block Group

• trct – US Census Tract

• zcta – US Census Zip Code Tabulation Area

• cty – US County

• stplc – US Census Place

• cbsa – US Census Combined Statistical Area

• cty – US County

• st – US State

• polygon - custom shapefile polygon

polygon represents the name of the zipped file containing the ESRI shapefile defining a polygon that must be supplied.

shapedir – this string must be supplied if the oname geography is polygon. It points the directory where the ESRI zipped shapefile is located.

geo_id – This string allows selecting to retain output only for a specific geography id.
When using a shapefile polygon, this feature is automatically activated to retain only data for the polygon.

work_seg – this string specifies which job types, cohorts, and industry sectors.
Refer to the LODES Technical Documentation
for a full list job types, cohorts, and industry sectors.

saveas – save output as a Stata dataset.

exportexcel – if saveas() is specified, export output to an Excel spreadsheet.

replace – if saveas() is specified, overwrite the existing files.

saveframes – if saveas() is specified, save the imported data as a Stata frame.
This option saves two data frames, the main data imported for analysis (e.g., od)
and the selected state geography cross walk frame (e.g., fl_xwalk).

deleteframe – remove the generated output frames.

browse – browse the output data frame.

Examples

Importing data

Example 1: . lodes get FL

imports Origin-Destination (OD) data for the state of Florida using default values: latest data release, and all jobs (JT00).
Note: some states do not have data for latest data release. In this instance, the program stops and tells you what is available.

Example 2: . lodes get CA, data_type(RAC) years(2018-2023) job_type(JT03)saveas([your_directory]/ca_rac_jt03_2018_2023)

imports data resident area characteristics (RAC) for California, Private Jobs (JT03), years 2018-2023 - saves data frames

Performing Destination Analysis

Note: to run the example below, you must first obtain the data using lodes get fl.

Example 1: . lodes destination zcta, dname(stplc)

Analyzes in which US Census places workers residing in the zip codes go to work using the latest data release, all jobs (JT00).

Example 2: . lodes destination zcta, dname(zcta) oname_id(33617) top_loc(20) saveas([your_directory]/zcta_33617_dest_example) replace saveframes

Analyses in which US zip codes workers residing in zip code 33617 go to work, focusing on the top 20 zip codes by total employment.
Data are saved and frames exported.

Performing Inflow-Outflow Analysis

Note: to run the example below, you must first obtain the data using lodes get fl.

Example 1: . lodes inflow_outflow zcta, work_seg(SA01 SA02 SA03)

Analyses inflow-outflow of workers at zip code level by age cohorts
(see LODES Technical Documentation).

Example 2: . lodes inflow_outflow tampa_cbd, shapedir([shapefile_directory]) work_seg (S000 SA01 SA02 SA03 SE01 SE02 SE03) saveas([your_directory]/tampa_cbd_inflow_outflow_example) exportexcel replace deleteframes saveframes

Note: to run the example above, you must first obtain the data using lodes get fl, data_type(od) years(2021-2023) od_part(main)

Analyses inflow-outflow of workers using a custom polygon (here, the Tampa CBD, Florida) focusing on all jobs
and for years 2021-2023 to conduct trend analysis. Data are saved as Stata file and exported as Excel. Data frame is deleted.

Performing Area Profile Analysis

Note: to run the example below, you must first obtain the data using lodes get FL, data_type(wac) years(2021-2023)

Example 1: . lodes area_profile cbsa, geo_id(45300) work_seg(C000 CNS16) browse

runs a profile analysis of workers area characteristics years 2021-2023
for the Tampa-St.Petersburg-Clearwater Metropolitan Statistical Area,
focusing on total jobs (C000) and jobs in the Health Care and Social
Assistance industry sector (CNS16). See
LODES Technical Documentation
for WAC file structure.

Example 2: . lodes area_profile tampa_cbd, shapedir([shapefile_directory]) saveas([your_directory]/tampa_cbd_profile_example) exportexcel replace browse

Runs a profile analysis of workers area characteristics for the years
2021-2023 using a custom ESRI shapefile called tampa_cbd
representing the Tampa Central Business District, Florida, obtaining data
on all jobs by age cohort and industry sectors. Data are saved as a Stata
file and exported as Excel. See
LODES Technical Documentation
for WAC and RAC file structure.

Author & Maintainer

Sisinnio Concas

email: concas@usf.edu

Center for Urban Transportation Research