How to source a syntax file from another syntax file in SPSS?

☆樱花仙子☆ 提交于 2019-12-06 03:11:45

Updated Following @AndyW's comments.

There is the INSERT and INCLUDE commands. INSERT is newer and more versatile than INCLUDE. See documentation on INSERT here.

The following is the basic syntax template:

INSERT  FILE='file specification'
       [SYNTAX = {INTERACTIVE*}]
                 {BATCH       }
       [ERROR = {CONTINUE*}]
                {STOP     }
       [CD = {NO*}]
             {YES}
       [ENCODING = 'encoding specification']

Thus, the following command can be placed in an SPSS syntax file

INSERT FILE='foo.sps'. 

and it would import foo.sps syntax file. By default, syntax must follow the rules of interactive mode, and the code wont stop on an error.

To avoid having to specify the full path to the file, the working directory can be specified as an argument in the INSERT statement or with a separate CD command. E.g.,

CD '/user/jimbo/long/path/to/project'

Another option is to use FILE HANDLE.

For more information see the SPSS Syntax Reference (available here as a large PDF file).

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!