Replies: 8 comments 24 replies
-
Hey @dacodevet, saspy has no idea of SAS format catalogs and format search paths or anything like that. What you have above, with setting the format search path sounds like the right thing. It's on SAS to be able to use formats, and find them, on it's own. Can you bring up SAS on it's own, submit that same options fmtsearch statement and proc print the datasets in question? Is it SAS itself that's abending? What version do you have? Also, I why, out of curiosity, are you using the method=csv? The default should be better. BTW, what version of saspy are you using? And I'm assuming (never a good thing) you're using the IOM access method to connect to a local windows SAS install? More details would be helpful, but lets start with those. If you can show me your 'winlocal' configuration definition, that would help too. |
Beta Was this translation helpful? Give feedback.
-
Ok, the versions and config are fine. Though you don't need that classpath in there at all. That's all handled for you now. So can you see any error or anything about what is happening on the SAS side? I don't really have any idea of what's happening. Have you tried anything to see what's going on? try submitting proc print of one of the trouble data sets after setting your fmtsearch, or anything else to try to see the log and see if there's a problem on the SAS side? |
Beta Was this translation helpful? Give feedback.
-
Well, the traceback above is from a sd2df_CSV(), and it seems SAS terminated, so I can't really get the log from it to then have available. As for options, you can set any options you like. sas.submit('options x=y;'). For invocation only options, saspy is starting up tour local SAS, so you can configure your sasv9.cfg file with whatever invocation options you like. |
Beta Was this translation helpful? Give feedback.
-
ok, so do you have the format library that has these formats and can you add it to the fmtsearch, so they can be found and used? |
Beta Was this translation helpful? Give feedback.
-
Since I don't know what you're running, i've tried to put together what I thing should be similar. Are you running your SAS session w/ errorabend or something that would terminate SAS if there was an error? In the case below, I just get the error about the format not found till I add it to the fmtsearch and then everything runs as expected.
|
Beta Was this translation helpful? Give feedback.
-
FYI, I just pushed the changes to catch and log failures in the intermediate steps of the sd2df() methods. That's where you were hitting your error. Those methods have to do a number of different SAS submits to gather metadata and stuff before then trying to transfer data. Your error was in one of those since SAS couldn't access the data set due to the format not being available. If you want to try this out (don't have to), you can pull the code from main (main branch in github) and give it a try with the case where you were getting the error. Should see something like what's above. Thanks, |
Beta Was this translation helpful? Give feedback.
-
Hi @tomweber-sas, I finally got to the bottom of what was causing my issues and I'm not sure if I missed an option or some other configuration. In the sd2df method, It writes out the dataset variables, types, formats and builds varlist etc. In my case, there were blank lines and titles(The SAS System) being written in the middle of my variable list which in turn produces a SAS error resulting in:
|
Beta Was this translation helpful? Give feedback.
-
I think I get what you're saying. Can you send me the log so I can actually see what it did, and the output from proc options, so I can see what would be causing that? Having never run into this before, I'm wondering if it's something specific to your setup or something. I'd like to be able to reproduce it to determine the right way to handle it. |
Beta Was this translation helpful? Give feedback.
-
Is there a way to associate sas format catalogs with sas datasets when converting sas to df using(sd2df())? The process abends when it tries to find formats for certain SAS datasets(other SAS datasets are converted successfully). I've already tried:
sas = saspy.SASsession(cfgname='winlocal', results='HTML')
sas.submit('''options fmtsearch=(xxx.my_formats);''')
stdf = sas.sd2df(table=xname, libref='XXX', method='CSV')
I really want to avoid creating a dictionary of that catalog or exporting the SAS dataset to csv to create the dataframe.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions