sassoftware / saspy

A Python interface module to the SAS System. It works with Linux, Windows, and Mainframe SAS as well as with SAS in Viya.
https://sassoftware.github.io/saspy
Other
366 stars 149 forks source link

sasdata2dataframe pagination is wrongly documented #598

Closed rainermensing closed 2 months ago

rainermensing commented 2 months ago

I am using saspy==5.1.2 and python 3.10 on both Windows and Linux.

I want to paginate through a sas table using sasdata2dataframe. The documentation shows the pagination implementation as : image

From this I would take that obs = page size and firstobs = where to start page. So in this example, start from row 12 and read 10 rows.

However, when I try to test it with obs = 1M and firstobs = 1M +1, hence start from row 1M+1 and read 1m rows, I get ERROR FIRSTOBS > OBS Errorr

Thus, the current implementation is actually obs = how many rows should I read and firstobs = where is the cutoff point from which I should keep the records. The docs are a bit misleading in this case.

tomweber-sas commented 2 months ago

Wow, that's a glaring inaccuracy! I'm going to have to get on whoever wrote that doc! (me). Thanks for catching that, and I'm sorry for the confusion. These are both just the SAS Dataset Options, not anything saspy implements. And, after 36 years of writing SAS, obs still trips me up when used with firstobs. Obs is really 'lastobs', not 'num of obs'. When used by itself (the 99% case for me), Num of obs == last obs. And I've never seemed to get it ingrained as 'lastobs'.

Curiously SPDS made up their own options for these, and it doesn't honor these; it has startobs and endobs.

Anyway, I'm sorry for the confusion and I'll update the doc with accurate values today!

rainermensing commented 2 months ago

@tomweber-sas thanks a lot for the fast response! No problem.

tomweber-sas commented 2 months ago

Ok, the doc should be correct now. I also noticed and fixed the comment in each of those from first obs is a number - either string or int to firstobs is a number - either string or int as firstobs is one word not two. Yet another doc typo. Again, thanks for letting me know about that. At least it's just the doc; the software works right! :)

Tom

tomweber-sas commented 2 months ago

I'll go ahead and close this. But if there's anything I missed, feel free to reopen. And there's anything else, please open another!

Thanks! Tom