#include
Use the #include directive to insert the contents of a file into the source file.
Syntax
#include "filename"
Parameter
filename
The name and location of the file to include. Paths can be relative or absolute.
Remarks
Include files are useful for inserting commonly used routines into a source file. The routine needs to be written only once and can then be included in any source file that requires that routine. An include file can also contain preprocessor directives, including the #include directive.
Include files are often of the same file type as the source file. However, you can include a mrScriptBasic (.mrs) file in an event section of a data management script, for example.
For more information about using include files in data management scripts, see
Using include files in the DMS file.
For more information about using include files in interview scripts, see
Using include files in interview script files.
Text encoding
Save the source file and all include files by using the same text encoding option: either ANSI or Unicode. If the files contain only Western European characters, use the ANSI option; if any of the files contain non-Western European characters, use the Unicode option for all of them.
Use the UTF-8 option only when saving source files that do not contain #include directives.
Example
The following example uses the #include directive to insert the contents of a .mrs file into a mrScriptBasic script. The .mrs file contains a mrScriptBasic function called FormatOrdinal:
#include "[INSTALL_FOLDER]\IBM\SPSS\DataCollection\7\DDL\Scripts\General\mrScriptBasic\FormatOrdinalFunction.mrs"
Dim MyOrdinal
MyOrdinal = FormatOrdinal(MyValue)
See also