Re: Has anybody already created a way to read "tagged" data into SPSS?

Posted by jkpeck on
URL: http://spssx-discussion.165.s1.nabble.com/Has-anybody-already-created-a-way-to-read-tagged-data-into-SPSS-tp5740888p5740891.html

There is a Python library named pymarc that reads MARC21 files and has methods for working with that.  

It says,
https://pypi.org/project/pymarc/

pymarc is a python library for working with bibliographic data encoded in MARC21. It provides an API for reading, writing and modifying MARC records. It was mostly designed to be an emergency eject seat, for getting your data assets out of MARC and into some kind of saner representation.

You can install it in Statistics like this
STATS PACKAGE INSTALL PYTHON=pymarc.


A simple usage example:
from pymarc import MARCReader
with open('test/marc.dat', 'rb') as fh:
    reader = MARCReader(fh)
    for record in reader:
        print(record.title())

Specifics would depend on the tag set.  If you have a sample MARC file and can provide some information on what you want from it, I can write a little code that would turn it into a simple csv file that could then be read into Statistics (or used elsewhere).