Commands only available in EpiData Analysis Classic: Download Software |
|
|
|
Syntax for all commands: command <variables> [!option] [!option := a|b] If you are in doubt of when to use double quotes "" and when not, the rule is: |
↥ Read & Save Data | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
read |
read [{"<filename>" | <expression>}.{rec|csv|epx|epz|dta}" ] [!options ...] Read a copy of the data file into memory. Note: name must be contained in " " and extension must be supplied. If you use a case sensitive operating system (MAC or Linux) then case of filename and extension is important. Examples: read "bromar.rec"; // complete filename provided read "bromar" + ".epx"; // expression using two strings in concatenation new global fn string := "bromar.epx"; read fn; // expression where the variable fn is used, the file "bromar.epx" will be read. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
save |
save [{"<filename>" | <expression>}.{csv|epx|epz|dta}"] [!replace] [!format:="{stata|epidata|csv}"] [!force] Save a copy of all variables in memory to a file - to use the data again later
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
↥ Append, Merge & Aggregate | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
append |
append [<var1> <var2>...] [!ds := <dataset>] [!fn := <filename>]
Add observations after all observations in current file Options:
See variables on using referenced variables for this command |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
merge | merge [<key1> <key2> ...] [!fn [:= "<filename>":]] [!ds := <dataset>] [!table] [!combine | !update | !replace]
Merge the current data file with another dataset file based on key variable(s). The result is a NEW dataset which is added to the top level of the project.
After merge the variable mergevar indicates source of information for each observation (records).
Examples: // Load a project read "Clinical Example.epx"; // A: Internal merge (1 related dataset) // Since the current used dataset only has a single related dataset, there is enough information provided by the key variable to combine to two datasets. merge; // B: Internal merge (2+ related datasets) // The currently used dataset have 2 or more related datasets, so we need to use the option !ds := <id> to specify which dataset we want to merge with. // Use Command list ds // to see which dataset id's you have in the project merge !ds := labdata // C: External merge (1+ dataset in external file - e.g. a .csv file) // In order to merge with an external file the key variables to merge on must be provided merge patientid !ds := "PatientNames.csv":labdata // D: External merge (2+ datasets in external file) // In order to merge with an external file that has 2+ dataset, both the key variables AND the dataset you with to merge with must be provided! merge patientid !ds := firstdataset !filename := "PatientNames.epx" See variables on using referenced variables for this command |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
aggregate agg |
agg [<var1> <var2>...] [!options] Aggregate - collapse - combine - data when you wish to change from individual to group level. Options: See variables on using referenced variables for this command
// define a global vectore for column texts: new global columnhead[5] string; columntxt[1] := "Group"; columntxt[2] := "N Total"; columntxt[3] := "n (observed)"; columntxt[4] := "Mean"; columntxt[5] := .; agg sex age !by:=family !header:=columntxt !mci:=economy !mci:=children ; |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
↥ Using datasets & Sorting | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
use |
use <dataset>
Change the active dataset of a project. See variables on using referenced variables for this command read "Clinical Example.epx"; list dataset; use datafile_id_2; |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
sort |
sort variable1 [variable2 ...] [!descending] Sorts the current dataset based on the given variables. Sort respects current select!
See variables on using referenced variables for this command |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
↥Create new content | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
new project new p |
new project Creates a new empty project, e.g. for simulation or testing.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
new dataset new ds |
new dataset dataset1 [!options...] Create a new dataset for the project. Use the options to specify relations between datasets
See variables on using referenced variables for this command |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
new variable new var new v |
new variable variable1 <type> [:= expression] [!options...] Create a new variable of a given type and optionally assign the value in expression.
new variable v1 integer := 1 + 2 * 3 - 4; new variable v2 float := (2 * pi) * 5; new variable v3 string := "Hello World!"; new variable v4 time := now(); new variable v5 boolean := (2 > 3); new variable v6 date := today(); Examples where a value depends on other variables: new variable v1 integer := v14 + v17; // v1 is equal to sum of v14 and v17 new variable age date := integer((today() - dateborn)/365.25) // calculated age See variables on using referenced variables for this command |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
new global new g |
new global variable1 <type> [:= expression]
new global variable1[<integer expression>] <type> [:= expression]
Create a new global parameter variable with a given type and optionally assign the value given in an expression. If the name is post-fixed with square brackets [...], then a global vector is created, where each entry can be individually addressed using e.g. "g[3] := 20". If a value is assigned when creating a new global vector all entries of the vector will have the same value! Examples: new global g1 integer := 1 + 2 * 3 - 4; new global g2 float := (2 * pi) * 5; new global g3 string := "Hello World!"; new global g4 time := now(); new global g5 boolean := (2 > 3); new global g6 date := today(); new global g7[10] integer := 10;See variables on using referenced variables for this command |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
new valuelabel new vl |
new valuelabel valuelabel1 <type> (<value> , <label>) (...) [!m := <value>]
Create a new value label set with a given type (boolean not supported) and assign at least one (value, label) pair.
Each (value, label) pair will be added to the newly created set. The datatype of the value MUST match the defined datatype for the value label set itself. Note: An empty set will restrict data entry to system missing only!
See edit valuelabels for more advanced use of variables and loops to create additional valuelabels See variables on using referenced variables for this command |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
↥List content | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
browse |
browse [variable1 [variable2 ...] ] [options] Show the variables mentioned in a spreadsheet grid
See variables on using referenced variables for this command Note that browse is much faster than list |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
list data list d |
list data [variable1 [variable2 ...]]
Show values on the screen for all variables mentioned, with one observation per line (not limited by the width of the display)
Note that browse is much faster than list. Select: the sequence number is within the current select if you used a select statement, not for the whole dataset.See variables on using referenced variables for this command |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
list project list p |
list project
Shows a brief overview of the project
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
list dataset list ds |
list dataset
Shows a list of datasets for the project
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
list variable list var list v |
list variable
List currently defined variable names, types, formats and labels |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
list valuelabel list vl |
list valuelabel
Shows the full list of all valuelabel sets. Each set is listed individually as value/label pair and marked whether a value is considered missing or not. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
list results list res list r |
list results
List all current result variables and their values
- means, describe, tables and other estimation commands create result variables, e.g. $mean1 or $count |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
list global list g |
list global
List currently defined global parameters and their types and value. Global parameters can only contain a single value. But you may give them varying values and use functions to create content values. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
↥Edit definitions of projects, datasets, variables and labels | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
edit project edit p |
edit project Edits a project.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
edit dataset edit ds |
m
edit dataset dataset1 [!options...] Edits an existing dataset in the project.
See variables on using referenced variables for this command |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
edit variable edit var edit v |
edit variable variable1 [!<options>...]
Edit the metadata of variable1. The options specify which metadata are changed, multiple options may be used at once
Note: Data values are NOT changed! Even if the new length or decimals is shorter than actual content. To keep the changes made you must save the data.See variables on using referenced variables for this command |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
edit valuelabel edit vl |
edit valuelabel valuelabel1 [(<value> , <text>) ...] [!m := <value>] [!delete := <value>] [!nomissing := <value>]
Edits an existing value label set and optionally assign any number of (value, label) pairs.
See variables on using referenced variables for this command |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
edit data edit d |
edit data [!md] [!nomd] [!mv] [!nomv]
Edit the status of observations
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
↥Deleting content | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
drop dataset drop ds |
drop dataset dataset1 [dataset2 ...] Remove the listed datasets (and related datasets) from memory See variables on using referenced variables for this command |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
drop variable drop var drop v |
drop variable variable1 [variable2 ...] Remove the listed variables from memory See variables on using referenced variables for this command |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
drop global drop g |
drop global [variable1 ...] [!all [:= <type>]] Remove the listed global variables from memory
new global i1 int; new global i2 int; new global f1 float; new global f2 float; new global s1 string; drop global i2; // drops i2 drop global !all := "float"; // drops f1 and f2 drop global !all; // drops i1 and s1 (because they are left) See variables on using referenced variables for this command |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
drop valuelabel drop vl |
drop valuelabel valuelabel1 [valuelabel2 ...] Remove the listed value label sets from memory. If the set is assigned to a variable, then this assignment is automatically removed See variables on using referenced variables for this command |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
drop data drop d |
drop data [!del] Drops all data within current select from memory. Save the data first if you wish to keep any changes.
read "bromar.epx"; select (id > 1000) do drop data; // Drops all observations where id > 1000, but keeps the rest. read "bromar.epx"; drop data !del ; // drop all observations "marked for deletion" |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
↥ Select observations | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
select ... do |
select <logical expression> do <statement> Work with selected observations (subgroup of data) Select requires a command or a begin ... end segment following the expression. After the command(s) are executed, the dataset is no longer reduced. Note: The commands merge, append, save cannot be used with the select ...do ...; statement.It is possible to make nested selects which will combine the selects. Example: select (V1 > 3) do begin count; // This command counts number of observations where (v1 is > 3) select (V1 < 4) do begin count; // This command counts number of observations where ((v1 is > 3) and (V1 < 4)). end; end; |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
↥ Changing flow of the script | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if ... then ... else ... |
if <logical_expression> then <statement or command> [else <statement or command>] This is a "flow" control statement - which will evaluate logical_expression once and execute the command(s) following then
when the logical expression is true. Note: This statement is not normally used to change values of variables (see the example below).
The else clause is optional and is only executed if evaluation of the logical expression is false. if (dayofweek(today()) = 1) then freq v12 // will show variable v12 on mondays else freq v13; // will show variable v13 on other days of week. Note: The flow control of "if ... then .... was completely different in EpiData Analysis Classic v2.2. // In Analysis 2.2 to change all system missing values in V1 with the value 99 if (V1 = .) then V1 := 99; // To do the same in current Analysis use this syntax: select (V1 = .) do V1 := 99; |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
for .. to .. do |
for <var> := <start value> to|downto <end value> do <statements>; Loops through the integer values from start to end either in ascending order (to) or descending order (downto). new variable ID integer; // this creates the new ID variable new global i integer; for i := 1 to size(@dataset[1]) do ID := i; // This gives the ID variable the sequential number that each observation has in a dataset. You may sort the data before doing so. See variables on using referenced variables for this command |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
for .. in .. do |
for <var> in [<value1>, <value2>, ...] do statements; Loops through the values one by one, assigning it to <var> The only restriction in this loop is that the datatype of <var> and <value> must be the same! Examples: new global I integer; for I in [1, 3, 5, 7, 9] do ? I < 10; // "regular" integer loop. new global F float; for F in [1.1, 3.3, 5.5] do ? fraction(F); // Looping with floating values new global S string; for S in ["Denmark", "Norway", "Sweden", "Finland"] do ? S + " is a nordic country";See variables on using referenced variables for this command |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
↥ Reordering variables and ? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
reorder |
reorder var1 [var2 ...] [!options] Reorders the variables specified. This can be used to place specific variable together and used with variable expansion
If no options are specified, the default is to place the variables before all other variables in the list. Use F3 or "list variable" to show the current order of variables. Examples: read "bromar.epx"; // Load the project reorder kmgrp agegrp decgrp; // Moves the variables kmgrpm, agegrp, and decgrp to the front of the list reorder age km !before := agegrp // Moved the variables age and km in front of agegrpSee variables on using referenced variables for this command |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
? |
? <expression> Show result of an expression. It is posible to use all types of variables (standard, results or global) in the expression. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
↥ Change variable content | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Assign the value given in an expression. The variable type and expressions must be compatible otherwise an error will occur. Here all observations get the same value: v1 := 1 + 2 * 3 - 4; v2 := (2 * pi) * 5; v3 := "Hello World!"; v4 := now(); v5 := (2 > 3); v6 := today(); It is also possible to assign a value to individual entries of a variable: v1[1] := 3; v2[2] := 31.41596; v3[3] := "It works!"; v4[1] := Createtime(12, 34, 56);If you specify a conditional (depend) rule based on other variables the change only occurs for the subgroup defined by the select statement: select (v1 = 0) do v17 := 17; select ((v1 = 0) and (v2 = .)) do v17 := 27;Functions may be used: select (age = .) do age := integer((today() - dateborn)/365.25) // calculated age |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
↥ Tables & Frequencies | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
freq fre |
freq variable1 [!<option> ...] Frequency distribution for variable1 See variables on using referenced variables for this command
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
tables tab |
tab <column variable> <row variable> [!<option> ...] The tables (brief: tab) command shows a cross tables for the variables chosen. See variables on using referenced variables for this command The default sorting for the cross tables is increasing value, regardsless of any valuelabel for the variables. Use options below to change the sort order!
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
↥ Means and Count | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
count |
count Counts number of observations. Count may be used with select to count within a subgroup Result variable: $count. Use list results for details |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
means |
means variable1 [!by=variable2] [!t] Basic descriptive statistics for variable1, optionally stratified by variable2 See variables on using referenced variables for this command
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
↥ Consistency and Validity Check of data | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
check data |
check data [var1 ...] Use this command to perform a check of the data in selected variables (if no variable are specified, then ALL variable are checked).
See variables on using referenced variables for this command |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
check key |
check key [var1 ...] Use this command to perform a check of the data in specified variables whether the data is unique and represent a key. See variables on using referenced variables for this command |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
check relate |
check relate Performs a check on data and whether all observations have a valid parent observation Examples: read "related_data.epx"; // Load the project use child_dataset; // Change dataset to a related dataset check relate; // Perform the check from the child dataset "upwards" to the parent. Must be repeated if you have more levels |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
check study |
check study Performs a check on the study information of whether it is filled or not. Examples: read "samplev3.epx"; // Load the project check study; // Perform the check |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
↥ Reports | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
report users |
report users If a project is using Extended Access control, this command will show a condensed report of the log entries and a list of failed login attempts. If the project is not using Extended Access control, an error will be displayed. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
report val |
report validate [var1 var2 ...] [!options] Compares two dataset / projects against eachother, validating the data content and outputs a report of diffenrences based on the comparison. The variables var1 .. varn denotes the sorting variables. This is required if not comparing whole projects OR if the datasets does not contain and key variables.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
report cby |
report cby [var1 var2 ...] [!options] Compares the combination of variables across several datasets. The variables var1 .. varn is considere a "key" and each unique combination of this key is counted across all the specified datasets. The output is a report with a condensed table of the found keys and a complete table with the found unique key values and the count of these in each dataset.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
↥ Disk commands | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cd |
cd ["<directory path>"] Change the working directory (folder) to the specified path. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ls dir |
ls ["<directory path>"]
list files in a directory |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
erase |
erase "<file name>"
Delete the file from disk. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
↥ Set parameters | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
set |
set ["parameter"] := ["value"]
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
↥Labeling and formatting data | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Valuelabels |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Variable Labels |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Formatting |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
↥Variable types | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
integer int i |
A variable (standard, result or global) that contains an integer value. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
float f |
A variable (standard, result or global) that contains an floating point value. Note: all floating points shown on screen appear in the current national setting (locale), but input (from editor or command line) must always use "." (period) as the decimal separator. The saved data in a given project can be used in different national settings without giving problems or need for conversions. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
string str s |
A variable (standard, result or global) that may contain any string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
boolean bool b |
A variable (standard, result or global) that contains only true or false | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
time t |
A variable (standard, result or global) that contains a time value. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
date d |
A variable (standard, result or global) that contains a date value. All new date variables created will be a DMY type, but this may change in the future. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
↥Using Variables and references | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Variable Expansion var1 - var4 va* var? |
Any command that accepts more than 1 (one) variable can use the scheme for variable expansion.
It is possible to combine "*" and "?" for more elaborate expressions, but neither can be combined with "-" Variables for expansion cannot start with the "*" or "?", but must start with a "normal" character. Example: // Consider the following set of variables (and in that order): // V1, V2, V3, V4, V10, V11, V100 list data V2 - V10; // V2 - V10 is expanded to the variables V2, V3, V4 and V10 list data V1* ; // V1* is expanded to V1, V10, V11, V100 because * can be "" (empty character) and "0", "1" and "00" list data V? ; // V? is expanded to V1, V2, V3 and V4, because ? can be be replaced by "1", "2", "3" and "4" but not any other. list data V1??; // V1?? is expanded to V100 only! Referenced variable may also be used in the expansion. These will be evaluated before the expansion! |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Variable variable1 |
Any command that accepts variables can use this variant. This is the "default" way to provide a variable to a command. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Referenced Variable @{variable1} |
With a referenced variable, you essentially use the content of another variable (global, result) as the variable. Examples: new global gvar1 string := "sex"; read "bromar.epx"; freq sex; // Outputs a frequency table for the variable "sex" freq @{gvar1}; // Does the same as above, because the content of gvar1 is "sex"This can be combined with eg. indexing of a variable. Using some of the builtin result variables like $dataset and $variable: new global i integer; for i := 1 to size($variable) do begin // Here we output the name of all the variables: // - not using the @{..} because we want the content of the $variable result var. ? $variable[i] // Here we do a frequency table of the variable. // - using @{..} because "freq" needs a variable and not the content of $variable freq @{$variable[i]} end;The Variable inside the @{..} may itself be another reference (with or without index), making it possible to combine multiple levels of references. new global f string := "age" new global g[3] string := "f"; // All entries have the value "f", but that is fine for this example. new global h[3] string := "g"; // All entries have the value "g", but that is fine for this example. // The line below is a valid construction, which evalutes the following way // 1: h[1] is evaluated into the string "g" // 2: "g" is used in @{"g"}, which means - use the content of g as a variable // 3: g[1] is evaluated into the string "f" // 4: "f is used in @{"f"}, which means - use the content of f as a variable // 5: @{f} is evalued to the variable AGE // 6: The command freq is run on the variable AGE. freq @{ @{h[1]}[1] }; Example of how to loop over a referenced variable: // you wish to estimate the time for parts of an analysis and have created a number of time stamps: new global tx t:= now(); // where x is 1 , 2, 3 etc. // now to display these and the difference: - assume you had five of these: new global i i; for i:= 1 to 5 do begin ? i + " time: " + @{"t" + i}; // this works becaus the parenthesis will be t1 t2 t3 etc. end; // now also calculate the difference in time between the two: new global tdif t; // tdif is a time difference for i:= 2 to 5 do begin tdif := (@{"t" + i} - @{"t" + (i-1)}); // notice again the (tdif = t2 -t1 ) when i was = 2 ? i + " difference : " + tdif; end; |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
↥ Programming aids - not normally used in interactive mode | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
runtest |
runtest ["<directory path>"]
Run all pgm's in a given directory (folder) to verify function. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
run |
run ["<filename.pgm>"] Execute sequence of commands saved in a pgm file |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
↥ Clean up - clear screen and history | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
close |
close Stop using a project - all unsaved variables and changes to existing variables and labels will be lost - global variables will remain in memory |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cls | cls Clear the output screen |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
clh | clh Clear the history of commands |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
reset | reset Complete reset of all parameters of the program! But this also clears all result variables! |
↥Functions available in EpiData Analysis | |||
In the following, takes indicates the variable type for each parameter and result indicates the type of the result of the function: s: string; b: boolean; d: date; t: time; i: integer; f: floating point; n: any numeric; v: variable parameters may be variables read from fields, new created variables, or any expression that evaluates to the correct type. |
↥ String functions | |||
function | takes | result | example |
length(str) | s | i | length("Abcde") => 5 |
pos(instr, findstr) | s, s | i | pos("Abcde", "cd") => 3 pos("Abcde", "z") => 0 |
substring(str, start, len) | s, i, i | s | substring("Abcde", 2, 3) => "bcd" |
trim(str) | s | s | trim("Abcde ") => "Abcde" trim(" Abcde") => "Abcde" |
lower(str) | s | s | lower("Abcde") => "abcde" |
upper(str) | s | s | upper("Abcde") => "ABCDE" |
concat(X, s1, s2, ..., sn) | s, any, ... | s | Concat(...) concatinates values s1 -> sn into a string. If any of the sx parameters return sys. missing it will be replaced by the value of X concat("X", "a", v1[_n]) => "aX" if v1 is missing, else a + the value of v1 NOTE: the concat function only adds the first parameter for system missing (.), for user defined missing the actual value is added for that variable. |
↥ Arithmetic functions (including Random numbers) | |||
function | takes | result | example |
abs(x) | n | n | abs(-12) => 12 |
exp(x) | n | f | exp(1) => 2.71828182845905 |
fraction(x) | f | f | fraction(12.34) => 0.34 |
ln(x) | n | f | ln(2.71828182845905) => 1 ln(0) => missing |
log(x) | n | f | log(10) => 1 log(0) => missing |
round(x, digits) | n, d, t | f | round(12.44,1) => 12.4 round(12.5,0) => 13 |
sqrt(x) | n | f | sqrt(4) => 2 |
random(x) | i | i | Random integer from 0 to x |
sum(n1, n2, ..., nn) | n, ... | n | Sums that values n1 => nn, but ignores the entries if they are either sys. missing or user defined missing |
↥ Trigonomety functions | |||
function | takes | result | example |
tan(x) | f | f | tan(0) => 0 |
arctan(x) | f | f | arctan(1) => pi/2 |
cos(r) | f | f | cos(pi/2) => 6.12303176911189E-17 cos(pi) => -1 |
arccos(r) | f | f | arccos(0) => pi / 2 |
sin(r) | f | f | sin(pi/2) => 1 sin(pi) => 6.12303176911189E-17 |
arcsin(r) | f | f | arcsin(0) => 0 |
↥ Date functions | |||
function | takes | result | example |
createdate(datestr) | s | d | createdate("31/12/2016") => 31/12/2016 The form of datestr is automatically detected, but if the string is ambiguous the preference is always DMY over MDY. If parts of the datestr are omitted, then these parts are filled with todays values. |
createdate(datestr, fmt) | s, s | d |
createdate("31/12/2016", "dmy") => 31/12/2016 createdate("12/31/2016", "mdy") => 31/12/2016 createdate("2016/12/31", "ymd") => 31/12/2016 |
createdate(d, m, y) | i, i, i | d | createdate(31, 12, 2016) => 31/12/2016 |
today() | - | i | returns today's date; may be assigned to a date variable or an integer |
day(d) | d | i | day(31/12/2004) => 31 |
dayofweek(d) | d | i | dayofweek(31/12/2004) => 5 Monday=1, Sunday=7 |
month(d) | d | i | month(31/12/2004) => 12 |
week(d) | d | i | week(22/02/2001) => 8 |
year(d) | d | i | year(31/12/2004) => 2004 |
↥ Time functions | |||
function | takes | result | example |
createtime(timestr) | s | t | createtime("12:34:56") => 12:34:56 The form of timestr is automatically detected. If parts of the timestr are omitted, then these parts are filled with 0 (zero). |
createtime(h, m, s) | i, i, i | t | createtime(12, 34, 56) => 12:34:56 |
now() | - | f | returns the time right now. It can be assigned to a time or float variable |
second(t) | t | i | second(12:34:56) => 56 |
minute(t) | t | i | minut(12:34:56) => 34 |
hour(t) | t | i | hour(12:34:56) => 12 |
↥ Logic functions | |||
function | takes | result | example |
b1 and b2 | b,b | b |
true and true => TRUE true and false => FALSE false and true => FALSE false and false => FALSE |
b1 or b2 | b,b | b |
true or true => TRUE true or false => TRUE false or true => TRUE false or false => FALSE |
b1 xor b2 | b,b | b |
true xor true => FALSE true xor false => TRUE false xor true => TRUE false xor false => FALSE |
not(b) | b | b |
not(true) => FALSE not(false) => TRUE |
↥ Conversion functions | |||
function | takes | result | example |
boolean(x) | any | b |
boolean(x) => TRUE, for any non-zero x boolean(0) => FALSE boolean("true") => TRUE, "true" text is case in-sensitive boolean(x) => FALSE, for any text other than "true" |
integer(x) | any | i |
integer(1.23) => 1 integer(31/12/2016) => 42735 integer("2") => 2 integer("a") => . Any input x that cannot be interpreted as an integer returns missing "." |
float(x) | any | f |
float(1) => 1.00 float("12,34") => 12.34 Any input x that cannot be interpreted as a float returns missing "." |
string(x) | n | s | string(1.23) => "1.23" |
↥ Identifier functions | |||
function | takes | result | example |
exist(x) | v | b | Returns true/false whether the provided identifier exist |
idtype(x) | v | i | Returns the type of the identifier provided. This function cal be used on all valid identifiers and the integer value returned have the following associations: 0: Global variable 1: Global vector 2: Regular Variable 3: Dataset 4: Valuelabel 5: Result Variable 6: Result Vector 7: Result Matrix Note: if using idtype(x) with the eval function "?", the output will be in text. |
datatype(x) | v | i | Similarly as to idtype(x) this function takes any variable, but in this case returns the type of date stored in the variable. The integer value return have the following associations: -1: Variable has no data type - e.g. a dataset variable. 0: Boolean 1: Integer 2: Auto Increment 3: Float 4: DMY Date 5: MDY Date 6: YMD Date 7: DMY Auto Date 8: MDY Auto Date 9: YMD Auto Date 10: Time 11: Auto Time 12: Uppercase String 13: String 14: Memo Note: if using datatype(x) with the eval function "?", the output will be in text. |
size(x) | v | i | Size returns the size/length of an identifier (if applicable). The function works as follows: Global & Result variables always have size 1 Global vector, Result Vector, Variable & Valuelabel return the length/size/count of elements/data Result Matrix is not implemented yet - it returns -1; Dataset returns the total number of observations (even if a select is applied). |
label(v) | v | s | Return the descriptive label of the identifier. This is only possible for variables and datasets. |
↥ Test and special functions | |||
function | takes | result | example |
lre(x,y) | n | n | lre($mean1, 1.23456789123456) returns number of digits precision of $mean1 |
iif(b, x, y) | b, n, n | n |
iif(..., true value, false value) evaluates the boolean expression (b) inline, and based on the result either returns the true value or false value. iif(2 = 3, "This is true", "This is false") => "This is false" |
samevalue(x, y, z) | x,y = n, d, t z = i |
b | samevalue($mean1, 1.23456789123456, 10-7) returns true or false indicating if |(x-y)| < 10z Best used for comparing floating point values. Since internal binary representation of two seamingly even numbers may differ, using x = y can fail. |
samevalue(x, y) | n, d, t | b | samevalue($mean1, 1.23456789123456) returns true or false indicating if x = y Essentially the same as calling samevalue(x, y, 15) |
cwd() | - | s | Returns the current working directory |
deleted([index]) | [i] | b | Returns true/false whether the record is marked for deletion. If no index is supplied the current record number is tested: select deleted() do edit data !nomd // selects current records marked for deletion and unmark them |
verified([index]) | [i] | b | Returns true/false whether the record is marked as verified. If no index is supplied the current record number is tested: select verified() do edit data !nomd // selects current records marked for deletion and unmark them |
↥ Operators used in EpiData Analysis | ||||
operator | syntax | result | meaning | example |
+ | n+n | n | addition | 1+2 => 3 |
+ | s+any any+s |
s | concatenation | "A"+"B" => "AB" "A"+1 => "A1" |
+ | d+n | d | date addition | "30/11/2004"+31 => "31/12/2004" |
- | n-n | n | subtraction | 2-1 => 1 |
- | d-d | n | date subtraction | "31/12/2004"-"30/11/2004" => 31 |
- | d-n | d | date subtraction | "31/12/2004"-31 => "30/11/2004" |
* | n*n | n | multiplication | 2*3 => 6 |
/ | n/n | n | division | 5/2 => 2.5 5/0 => missing |
div | n div n | i | integer result of division | 5 div 2 => 2 5 div 0 => missing |
^ | n^n | f | exponentiation | 5^2 => 25 4^0.5 => 2 |
( ) | group expressions | (5*(2+4))/2 => 15 5*2+4/2 == (5*2)+(4/2) => 12 |
||
= | n = n | b | equal | 1 = 2 => FALSE |
< | n < n | b | less than | 1<2 => TRUE |
> | n > n | b | greater than | 1>2 => FALSE |
<= | n <= n | b | less than or equal | 1<=2 => TRUE 2<=2 => TRUE |
>= | n >= n | b | greater than or equal | 1<=2 => FALSE 2>=2 => TRUE |
<> | n <> n | b | not equal to | 1<>2 => TRUE 1<>1 => FALSE |
$ | $resultvar | result value | ? $count => 4027 |