if (FALSE) {
wrds <- wrds_connect()
# Annual North America fundamentals
funda <- get_compustat(wrds)
# Quarterly with date filter
fundq <- get_compustat(wrds,
frequency = "quarterly",
start_date = "2020-01-01",
end_date = "2023-12-31"
)
# Global annual
g_funda <- get_compustat(wrds, region = "global")
# Lazy query for further filtering
get_compustat(wrds, lazy = TRUE) |>
dplyr::filter(fyear >= 2020) |>
dplyr::select(gvkey, datadate, at, lt) |>
dplyr::collect()
# Fill missing SIC codes with header SIC from comp.company
funda_sic <- get_compustat(wrds, fill_sic = TRUE)
# Preview first 100 rows before full download
preview <- get_compustat(wrds, n = 100)
wrds_disconnect(wrds)
}
Run the code above in your browser using DataLab