Dear all
Unfortunately there was a small typing error in the information mail yesterday. See below.
A simple program to read an old rec file could be just like this:
read "myfile.rec";
freq v1;
means age !by:=sex;
save "testdata.epx"; save "testdata.csv"; save "testdata.dta";
if you then open the epx file in Manager or EntryClient, the csv file in a spreadsheet or the dta file in Stata you will see that data in your recfile were converted to these other formats.
To test the correct formulation of new and edit etc just try the example below. You may copy and paste the following into the editor (f5) after starting new analysis. The example is a bit complex, but shows the level of ambition in functionality we are aiming at. Notice that // should be used to give a comment on a line, NOT * as it was previously.
Obviously user-friendly dialogs will be added to assist in the formulation of syntax, but that will come later.
best wishes Jens Lauritsen EpiData Association, Denmark
.... copy from next line - and paste into EpiData Analysis .
// example pgm - enjoy testing . JL July 2017 // share experiences in testing on the EpiData List: // EpiData development and support epidata-list@lists.umanitoba.ca
// just examples of what you may want to test
// clear screen and empty memory for any global constants; cls; close; drop global !all ;
// create the project: new project !title:="testdata";
// add datasets: new dataset dataform1 !size:=20; new dataset dataform2 !size:=10; use dataform1;
// create new variables: new variable v1 integer := random(1000); new variable v2 float := (2 * pi) * 5 + random(500); new variable v3 string := "Hello World!"; new variable v4 time := now(); new variable v5 integer := random(1); new variable v6 date := today();
// do some analysis means v1 !t ; // test that v1 is different from 0; means v2 !by:=v5;
// create loop global constants: new global j integer; new global limit integer;
// simple loop test: for j:= 1 to 5 do ? "loop test : " +j;
for j:= 1 to 4 do begin limit := j*250; select (v1 < limit )do count ; end;
// or a bit more complex:
for j:= 1 to 4 do begin select (v1 < (j*250)) do count ; ? "the number at v1 < " + limit + " was: " + $count; end;
list var; list global; list result; list dataset; // sort sort v1 v2; list data;
select v1 > 500 do sort v2 !descending; list data; // notice the reverse of second half of data based on v2
set ; // you may change, e.g.: set "echo" := "off"
save "testdata.epx" !replace; save "testdata.csv" !replace; save "testdata.dta" !replace;