How can I read a SAS dataset?

前端 未结 5 1710
伪装坚强ぢ
伪装坚强ぢ 2021-02-06 02:34

I have a lot of files in SAS format, and I\'d like to be able to read them in programs outside of SAS. I don\'t have anything except the base SAS system installed. I could man

5条回答
  •  长情又很酷
    2021-02-06 03:14

    You could make a SAS-to-CSV conversion program.

    Save the following in sas_to_csv.sas:

    proc export data=&sysparm
        outfile=stdout dbms=csv;
    run;
    

    Then, assuming you want to access libname.dataset, call this program as follows:

    sas sas_to_csv -noterminal -sysparm "libname.dataset"
    

    The SAS data is converted to CSV that can be piped into Python. In Python, it would be easy enough to generate the "libname.dataset" parameters programmatically.

提交回复
热议问题