Search code examples
ztree

Loading Parameter Table


I am trying to load a parameter table.

I get error messages when opening the Parameter Table and trying to load a txt file (created with Excel and saved as a tab-delimited txt) via Treatmant -> Import Variable Table -> Group.

I tried using the advice given here: How to use table loader in ztree?

But I cannot import the parameter table generated.

The error messages say, e.g.:

Syntax error: line 1 (or above)

Error in period 0; subject 1


Solution

  • Parameter table in z-Tree is a special table and (if I am not mistaken) they are not meant to be exported or imported.

    I just assumed you would like to have a special matching structure. (If you are planing to do something else, my answer might not be relevant.)

    If you want to manage the Group variable from a file, you can create a table, say MATCHING and load an external file the same way it is described in the post you put the link. For instance something like that:

    Period    Subject    Group
    1          1          3
    1          2          3
    1          3          2
    ...
    2          1          2
    2          2          1 
    2          3          3
    

    and you can add a program (subjects.do) as follows under the background stage:

    Group = MATCHING.find(Subject == :Subject & Period == :Period, Group);
    

    Just make sure you define the group for each subject and each period as if the program cannot find a valid entry for the subject and the period, it will create trouble.

    Note: If you are using z-Tree 4, it seems that the variables need to be initiated first. This can be done by adding a program under the table. In z-Tree 3, this is not necessary.

    Loading an external matching file