Python sas7bdat module usage

后端 未结 4 896
温柔的废话
温柔的废话 2021-02-20 12:41

I have to dump data from SAS datasets. I found a Python module called sas7bdat.py that says it can read SAS .sas7bdat datasets, and I think it would be simpler and more straigh

4条回答
  •  孤街浪徒
    2021-02-20 13:02

    Personally I think the better approach would be to export the data using SAS then process the external file as needed using Python.

    In SAS, you can do this...

    libname datalib "/support/sas";
    filename sasdump "/support/textfiles/locked_data.txt";
    
    proc export
        data = datalib.locked_data
        outfile = sasdump
        dbms = tab
        label
        replace;
    run;
    

    The downside to this is that while the column labels are used rather than the variable names, the labels are enclosed in double quotes. When processing in Python, you may need to programmatically remove them if they cause a problem. I hope that helps even though it doesn't use Python like you wanted.

提交回复
热议问题