Skip to content

sas cannot read xport files version 8 produced by readstat #183

@ofajardo

Description

@ofajardo

In sas there are two ways of reading xpt files.

old way:

libname xptfile XPORT '/path/to/file.xpt5';

proc copy in = xptfile out = work;
run;

and a new way with macro:

%XPT2LOC (FILESPEC= '/path/to/file.xpt')

When producing xpt files in SAS (sas.xpt5 and sas.xpt8) the old way can read only version 5, and the new way can read both.

When producing files with Readstat (using R haven (files haven.) or using the program writeEx in C, attached, (files writeEx. )), the old way can read the version 5 OK. The new way however cannot read neither version 5 or 8 (see screenshot). The SAS log is attached. it seems that the critical lines in the sas log are these:

68        +format i  . ;
                              _
                              85
                              200
                              76
 69        +informat i  . ;
                                _
                                85
                                200
                                76
 
 ERROR 85-322: Expecting a format name.
 
 ERROR 200-322: The symbol is not recognized and will be ignored.
 
 ERROR 76-322: Syntax error, statement will be ignored.

The xpt formats 5 and 8 and 9 seem to be public:

http://support.sas.com/techsup/technote/ts140_2.pdf
http://support.sas.com/techsup/technote/ts140.pdf

image

write_xpt.zip

another set of xport example files produced in SAS:

https://github.com/reikoch/testfiles

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions