Stata

1 program Added 2025-10-28T09:15:45Z Model: google/gemini-2.5-proTemp: 0.4 Evidence Report issue View issues
Aliases: Stata command language
Provenance: commit 88096883c9 · authored 2025-10-28T10:15:45+01:00 · model google/gemini-2.5-pro

Sources mentioning this language

8 sources · pl_id: pl/stata
LLM (this repo) · 1PldbLinguistPygmentsWikipediaHyperpolyglotRosettacodeWikidata · Q1204300

Wikipedia infobox

Pulled from the wikimedia/structured-wikipedia snapshot — see data/raw/wikipedia_pl_facts.*.jsonl and pl_fact.csv for the long-table provenance.

Designed byStataCorp
First appeared1985
LicenseProprietary
Homepagehttps://www.stata.com/

Extensions claimed by this language

9 claims. Each row is one upstream assertion with its strength. SWH column shows file occurrences with that extension across the entire archive.
ExtensionSourceStrengthSWH
.dolinguistprimary489.6K files
.dopygmentsprimary489.6K files
.adolinguistsecondary83.5K files
.adopygmentssecondary83.5K files
.dohlinguistsecondary232 files
.ihlplinguistsecondary1.6K files
.matalinguistsecondary7.8K files
.matahlinguistsecondary19 files
.sthlplinguistsecondary28.9K files

Related languages

Jacl (0.53)CCL (0.50)GCL (0.46)NCAR Command Language (0.46)DCL (0.45)

LLM-contributed programs

Data Preparation for Market Power Study

Provenance: commit 88096883c9 · authored 2025-10-28T10:15:45+01:00 · model google/gemini-2.5-pro · Temp 0.4
code.do · added: 2025-10-28T09:15:45Z
/*******************************************************************************
1_dataprep.do

This do file prepares the data for the analysis.

The code is divided into the following sections:

	1. Load data and define globals
	2. Generate variables
	3. Clean data
	4. Save data

*******************************************************************************/

clear all
set more off

/*******************************************************************************
1. Load data and define globals
*******************************************************************************/

* Define globals
global data "https://www.dropbox.com/s/95x6h23s32a7gff/deleeckereekhout_20170120.dta?dl=1"
global results "../Results"
global figures "../Figures"
global tables "../Tables"

* Load data
use $data, clear

/*******************************************************************************
2. Generate variables
*******************************************************************************/

* Generate year fixed effects
tab year, gen(yd)

* Generate industry fixed effects
tab ffi48, gen(id)

* Generate log sales
gen logsales = log(sale)

* Generate log assets
gen logassets = log(at)

* Generate log capital
gen logcapital = log(ppent)

* Generate log market value
gen logmktval = log(mktval)

* Generate log number of employees
gen logemp = log(emp)

* Generate investment rate
gen invrate = capx/ppent

* Generate cash flow
gen cashflow = (ib+dp)/ppent

* Generate Tobin's Q
gen q = (mktval+dltt-ceq)/at

* Generate leverage
gen leverage = (dlc+dltt)/at

/*******************************************************************************
3. Clean data
*******************************************************************************/

* Drop if missing sales, assets, capital, or cost of goods sold
drop if sale==. | at==. | ppent==. | cogs==.

* Drop if sales, assets, or capital are non-positive
drop if sale<=0 | at<=0 | ppent<=0

* Drop if cost of goods sold is negative
drop if cogs<0

* Drop financials and utilities
drop if ffi48==49 | (ffi48>=44 & ffi48<=48)

* Drop if investment rate is in the top or bottom 1%
sum invrate, d
drop if invrate>r(p99) | invrate<r(p1)

* Drop if cash flow is in the top or bottom 1%
sum cashflow, d
drop if cashflow>r(p99) | cashflow<r(p1)

* Drop if Tobin's Q is in the top or bottom 1%
sum q, d
drop if q>r(p99) | q<r(p1)

* Drop if leverage is in the top or bottom 1%
sum leverage, d
drop if leverage>r(p99) | leverage<r(p1)

/*******************************************************************************
4. Save data
*******************************************************************************/

saveold ../Data/deleeckereekhout_20170120_clean.dta, version(12) replace

Real programs from Software Heritage

1 sample mined from derived_datasets/<date>/contents/*.parquet, byte-verified against the SWH archive. Citation-grade qualified SWHIDs preserved.
Draw DD and DDD examples.do · 7245 B · ext .do · seen 59× in SWH
via fallback
swh:1:cnt:f68977ea3046e8b1afbe3cb58bc4c4d551d9573c;origin=https://github.com/spcorcor18/LPO-8852;anchor=swh:1:rev:f3f6500f030e5f344bcb9c24d53ad23b0ee584a4;path=/lectures/Lecture 4 - Difference-in-differences/Draw DD and DDD examples.do
Open in SWH · Raw bytes (SWH) · GitHub raw
Show source

cd "C:\Users\corcorsp\Dropbox\_TEACHING\Regression II\Lectures\Lecture 5 - diff in diff"


// Graph 1a: traditional DD picture (version 1)

graph twoway ///
   (function y=3+1.5*x, range(0 20) lcolor(green) lwidth(medthick)) ///
   (function y=7+1.5*x, range(0 10.5) lcolor(midblue) lwidth(thick)) ///
   (function y=11+1.5*x, range(10.5 20) lcolor(midblue) lwidth(thick)), ///
   legend(off) xline(10.5, lpattern(shortdash) lcolor(gs9) lwidth(vthin))  ///
   yscale(range(0 40)) ylabel(none, nogrid) ytitle("") ///
   yline(7, lcolor(midblue) lwidth(thin) lpattern(shortdash)) ///
   yline(41, lcolor(midblue) lwidth(thin) lpattern(shortdash)) ///
   yline(3, lcolor(green) lwidth(thin) lpattern(shortdash)) ///
   yline(33, lcolor(green) lwidth(thin) lpattern(shortdash)) ///
   xscale(range(0 20)) xlabel(none, nogrid) xtitle("") ///
   text(3 -1 "a", size(medlarge)) text(33 -1 "b", size(medlarge)) ///
   text(7 -1 "c", size(medlarge)) text(41 -1 "d", size(medlarge)) /// 
   title("Traditional DD example") name(graph1a,replace) nodraw
   
// Graph 1b: traditional DD picture (version 2)

graph twoway ///
   (function y=11+1.5*x, range(10.5 20) lcolor(midblue) lwidth(thick)) ///
   (function y=7+1.5*x, range(0 10.5) lcolor(green) lwidth(thick)) ///   
   (function y=7+1.5*x, range(10.5 20) lcolor(green) lwidth(medthick) lpattern(shortdash)) , ///
   legend(off) xline(10.5, lpattern(shortdash) lcolor(gs9) lwidth(vthin))  ///
   yscale(range(0 40)) ylabel(none, nogrid) ytitle("") ///
   yline(7, lcolor(green) lwidth(thin) lpattern(shortdash)) ///
   yline(41, lcolor(midblue) lwidth(thin) lpattern(shortdash)) ///
   yline(37, lcolor(green) lwidth(thin) lpattern(shortdash)) ///
   xscale(range(0 20)) xlabel(none, nogrid) xtitle("") ///
   text(41 -1 "d", size(medlarge)) text(37 -1 "b2", size(medlarge)) ///
   text(7 -1 "c", size(medlarge))  ///
   name(graph1b,replace) nodraw
   
graph combine graph1a graph1b, col(1) xsize(4) ysize(6)
graph export "graph1.png", as(png) replace

// Graph 2a: non-parallel trend (version 1)

graph twoway ///
   (function y=3+1.5*x, range(0 20) lcolor(green) lwidth(medthick)) ///
   (function y=7+2.7*x, range(0 10.5) lcolor(midblue) lwidth(thick)) ///
   (function y=11+2.7*x, range(10.5 20) lcolor(midblue) lwidth(thick)), ///
   legend(off) xline(10.5, lpattern(shortdash) lcolor(gs9) lwidth(vthin))  ///
   yscale(range(0 40)) ylabel(none, nogrid) ytitle("") ///
   yline(7, lcolor(midblue) lwidth(thin) lpattern(shortdash)) ///
   yline(65, lcolor(midblue) lwidth(thin) lpattern(shortdash)) ///
   yline(3, lcolor(green) lwidth(thin) lpattern(shortdash)) ///
   yline(33, lcolor(green) lwidth(thin) lpattern(shortdash)) ///
   xscale(range(0 20)) xlabel(none, nogrid) xtitle("") ///
   text(3 -1 "a", size(medlarge)) text(33 -1 "b", size(medlarge)) ///
   text(7 -1 "c", size(medlarge)) text(65 -1 "d", size(medlarge)) /// 
   title("Non-parallel trend") name(graph2a, replace) nodraw
   
// Graph 2b: non-parallel trend (version 2)

graph twoway ///
   (function y=7+1.5*x, range(0 20) lcolor(green) lwidth(medthick)) ///
   (function y=7+2.7*x, range(0 10.5) lcolor(midblue) lwidth(thick)) ///
   (function y=7+2.7*x, range(10.5 20) lcolor(midblue) lwidth(thick) lpattern(dash)) ///   
   (function y=11+2.7*x, range(10.5 20) lcolor(midblue) lwidth(thick)), ///
   legend(off) xline(10.5, lpattern(shortdash) lcolor(gs9) lwidth(vthin))  ///
   yscale(range(0 40)) ylabel(none, nogrid) ytitle("") ///
   yline(7, lcolor(midblue) lwidth(thin) lpattern(shortdash)) ///
   yline(65, lcolor(midblue) lwidth(thin) lpattern(shortdash)) ///
   yline(61, lcolor(midblue) lwidth(thin) lpattern(shortdash)) ///   
   yline(37, lcolor(green) lwidth(thin) lpattern(shortdash)) ///
   xscale(range(0 20)) xlabel(none, nogrid) xtitle("") ///
   text(37 -1 "b2", size(medlarge)) text(7 -1 "c", size(medlarge)) ///
   text(65 -1 "d", size(medlarge)) text(61 -1 "d2", size(medlarge)) /// 
   name(graph2b, replace) nodraw
   
graph combine graph2a graph2b, col(1) xsize(4) ysize(6)
graph export "graph2.png", as(png) replace

// Graph 3a: third difference example

graph twoway ///
   (function y=3+1.5*x, range(0 20) lcolor(green) lwidth(medthick)) ///
   (function y=7+2.7*x, range(0 10.5) lcolor(midblue) lwidth(thick)) ///
   (function y=11+2.7*x, range(10.5 20) lcolor(midblue) lwidth(thick)) ///
   (function y=60+1.5*x, range(0 20) lcolor(cranberry) lwidth(medthick)) ///
   (function y=67+2.7*x, range(0 20) lcolor(stone) lwidth(thick)), ///   
   legend(off) xline(10.5, lpattern(shortdash) lcolor(gs9) lwidth(vthin))  ///
   yscale(range(0 100)) ylabel(none, nogrid) ytitle("") ///
   yline(7, lcolor(midblue) lwidth(thin) lpattern(shortdash)) ///
   yline(65, lcolor(midblue) lwidth(thin) lpattern(shortdash)) ///
   yline(3, lcolor(green) lwidth(thin) lpattern(shortdash)) ///
   yline(33, lcolor(green) lwidth(thin) lpattern(shortdash)) ///
   yline(60, lcolor(cranberry) lwidth(thin) lpattern(shortdash)) ///
   yline(90, lcolor(cranberry) lwidth(thin) lpattern(shortdash)) ///
   yline(67, lcolor(stone) lwidth(thin) lpattern(shortdash)) ///
   yline(121, lcolor(stone) lwidth(thin) lpattern(shortdash)) ///
   xscale(range(0 20)) xlabel(none, nogrid) xtitle("") ///
   text(3 -1 "a", size(medlarge)) text(33 -1 "b", size(medlarge)) ///
   text(7 -1 "c", size(medlarge)) text(65 -1 "d", size(medlarge)) /// 
   text(60 -1 "e", size(medlarge)) text(90 -1 "f", size(medlarge)) ///    
   text(67 -1 "g", size(medlarge)) text(121 -1 "h", size(medlarge)) ///       
   title("Third difference (a)") ///
   name(graph3a, replace) xsize(4) ysize(7)
graph export "graph3a.png", as(png) replace
 
// Graph 3a: third difference example (versoin 2)

graph twoway ///
   (function y=7+1.5*x, range(0 20) lcolor(green) lwidth(medthick)) ///
   (function y=7+2.7*x, range(0 10.5) lcolor(midblue) lwidth(thick)) ///
   (function y=7+2.7*x, range(10.5 20) lcolor(stone) lwidth(thick) lpattern(shortdash)) ///   
   (function y=11+2.7*x, range(10.5 20) lcolor(midblue) lwidth(thick)) ///
   (function y=67+1.5*x, range(0 20) lcolor(cranberry) lwidth(medthick)) ///
   (function y=67+2.7*x, range(0 20) lcolor(stone) lwidth(thick)), ///   
   legend(off) xline(10.5, lpattern(shortdash) lcolor(gs9) lwidth(vthin))  ///
   yscale(range(0 100)) ylabel(none, nogrid) ytitle("") ///
   yline(7, lcolor(midblue) lwidth(thin) lpattern(shortdash)) ///
   yline(65, lcolor(midblue) lwidth(thin) lpattern(shortdash)) ///
   yline(62, lcolor(stone) lwidth(thin) lpattern(shortdash)) ///   
   yline(37, lcolor(green) lwidth(thin) lpattern(shortdash)) ///
   yline(97, lcolor(cranberry) lwidth(thin) lpattern(shortdash)) ///
   yline(67, lcolor(stone) lwidth(thin) lpattern(shortdash)) ///
   yline(121, lcolor(stone) lwidth(thin) lpattern(shortdash)) ///
   xscale(range(0 20)) xlabel(none, nogrid) xtitle("") ///
   text(37 -1 "b2", size(medlarge)) ///
   text(7 -1 "c", size(medlarge)) text(65 -1 "d", size(medlarge)) ///
   text(61 -1 "d2", size(medlarge)) /// 
   text(97 -1 "f2", size(medlarge)) ///    
   text(67 -1 "g", size(medlarge)) text(121 -1 "h", size(medlarge)) ///       
   title("Third difference (b)") ///
   name(graph3a, replace) xsize(4) ysize(7)  
graph export "graph3b.png", as(png) replace

Contribute — propose a file extension

Tell us where to find evidence about Stata (mapped to pl/stata). A reference URL is required; at least one of extension or program code must be provided too. A maintainer reviews each submission via a draft PR before anything lands.
Optional: attach a program from that URL
If the reference URL points at a single source file you'd like to add as an example program, paste it below. The workflow will write it under languages/Stata/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← Stasis State and Main →