Samples¶
In the app: Help → Help contents, Samples.
A sample chooses the rows a command uses: a span of periods, entities of a panel (country: DEU, FRA), a span per entity, and a condition on the data, in any combination. Name one with Data > Sample > New sample (Sample(...) in code) and make it a dataset's active sample with Data > Sample > Set sample (data.with_sample(...)), the equivalent of EViews' smpl: estimation, tests, tables and graphs on that dataset then use it unless they are given another span. It belongs to the dataset, and the line that sets it is recorded, so scripts and projects replay it. A sample only selects rows: lags still reach back before it, never across entities, and generated series are computed over all the data. Conditions are kept as text and applied to the data each time; results record the sample they used. In code, samples combine with & (and), | (or) and ~ (not).
To assign a series only within a sample, as EViews' smpl followed by y = ... does, give the sample under Within in Data > Generate series (with_series(y="...", within=Sample(...)) in code): the sample's rows are assigned and the others keep their values, missing in a new series. A formula that uses the series it assigns, such as y[-1]*1.02, is then computed one period at a time, each period seeing the values just assigned, as in EViews. with_series(y=None) makes a series of missing values (EViews' series y). File > New dataset makes an empty dataset of a frequency from a first to a last period (Dataset.empty("Q", "1990Q1", "2030Q4"); EViews' wfcreate). Data with no dates, one row per period in order, are dated from a first period: File > Load data's Dates start at with a frequency, for a CSV or Excel file, or Dataset.from_frame(df, start="1990Q1", freq="Q") (R's ts(x, start = c(1990, 1), frequency = 4)). The start must begin a period: 1990-03 is not a quarter's start.
A condition uses column names, numbers, text and dates in quotes (time >= '2000Q1'), comparisons, in [...] (country in ['DEU', 'FRA']), and, or, not, arithmetic and the functions abs, sqrt, exp, log, log10, log1p, expm1, floor, ceil, the trigonometric ones and arctan2. Anything else (@ references, attribute access with a dot, other functions) is refused before it runs, so a condition in someone else's project cannot run code.