FILE SAVE <text file> TO <Survo data file> followed by a list of the form: FIELDS: 1 <name of a field in Survo data file or '-'> <length or delimiters> 2 <name of a field in Survo data file or '-'> <length or delimiters> - - - K <name of a field in Survo data file or '-'> <length or delimiters> END where K is the number of fields in one logical record in the text file, copies a part of a text file to a Survo data file. If the Survo data file does not exist, a new file will be created. The fields of the text file are mapped to various Survo data fields according to the list. Fields which are not copied from the text file are indicated by a '-' in the list. If <length or delimiters> is not given, the field is assumed to be ter- minated by one or several spaces in the text file. However, the last field in each record must be terminated by a line feed. Other fields ending with line feed should be indicated by LF in the list. For example, 10 test3 LF The <length or delimiters> parameter can also be an integer giving the fixed length of the corresponding field in the text file or it can be a sequence of delimiter characters. For example, 11 test6 5 12 test7 :/ defines test6 as a field of 5 characters and test7 as a field of next characters ending by : or / or space. A delimiter can also be given in the form [decimal_value]. For example, 13 test8 [50][51] defines test8 to be terminated by one or several '1's or '2's. Please, note that 13 test8 12 would define test8 to be a field of 12 characters. The first line to be copied from the text file is given by the specification FIRST=<# of first line>. Default is FIRST=1. Similarly, the last line to be copied is given by LAST=<# of last line>. Default is the last line in the text file. To control the mapping from the text file to the Survo data file with respect to observations, a MATCH specification can be given. If MATCH is omitted, all the observations will be copied to the Survo data file as new observations. MATCH=<name of a field in the data file> specifies the field in the Survo data file whose contents should be equal to the corresponding field of the text file. The MATCH field has to be given as one of the items in the FIELDS list. Typically, the name of the observation serves as a match field. The order of the observations in the text file and in the data file must be same. Use either a string field or an integer-valued numeric field as a MATCH field. Non-integer fields are not safe as MATCH fields because their values can be rounded. By giving MATCH=#, the order of the observation will be used as a match variable. Example: FILE SAVE A:TEXT1,DATA2 _ copies lines from 4 to 33 (i.e. 30 obser- FIRST=4 LAST=33 MATCH=Name_ vations) from the text file TEXT1 on disk A: FIELDS: _ to the Survo data file DATA2 on the 1 Name _ current data disk. The match field is 2 Test1 _ 'Name' and the fields #2 and #4 are copied 3 - _ to Survo data fields 'Test1' and 'Test0', 4 Test0 _ respectively. END _ In all forms of FILE SAVE, code conversions are performed by a specification FILTER=<256_byte_conversion_file>. For making of code conversion files, see CODES? Unwanted characters (after conversion) are skipped by SKIP=<list_of_characters>. Example: SKIP=," Fields in the text file consisting of spaces and/or '-'s are treated as missing values. This convention can be overridden by a specification MISSING=<string> giving the code word <string> for a missing value. Example: MISSING=.. implies all fields with at least two consecutive '.'s to be missing values. The default mode (MODE=1), when interpreting the text file, considers spaces as delimiters also when other symbols are given as delimiters. Thus fields consisting of several words are not treated correctly. In such cases a apecification MODE=2 should be given. Then also empty fields terminating with LF will be accepted. In many cases it is useful to preprocess the text file by TXTCONV or TXTRIM. For example, harmful characters may be eliminated. Text files containing plain text or code characters (words) can be saved to Survo as values of one selected (string) variable by entering a specification either of form FORMAT=WORD,<variable>,"delimiters" or FORMAT=CHAR,<variable>,<length>. If FORMAT is given, the FIELDS list is not used at all. In the former case the the text in the text file is splitted into 'words' limited by line feeds and by any of the characters given as "delimiters". Default for "delimiters" is " ,.:;?!-". The 'words' are appended to the end of the Survo data file as values of <variable>. In the latter case code sequences of <length> characters are the 'words' to be saved as values of <variable>. Default is <length>=1. Spaces (decimal code 32) are skipped. By using the FILTER specification with an appropriate conversion file selected codes may be merged or skipped (by mapping them to spaces). I = Dealing with incomplete lines L = Dealing with long names of variables S = More information on FILE SAVE D = More information on data management