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
367 stars 149 forks source link

jupyter saspy output html #507

Closed cfkstat closed 1 year ago

cfkstat commented 1 year ago

jupyter saspy output html Variable display cannot be centered, how to fix it?

tomweber-sas commented 1 year ago

No idea whatsoever. Is there any information you can provide? Like the code you're trying to run and all of the output?

Thanks, Tom

cfkstat commented 1 year ago

just=c is not working.

image
tomweber-sas commented 1 year ago

Ok, thanks! That's helpful. Let me look into this and I'll see what's what. Thanks, Tom

tomweber-sas commented 1 year ago

Ok, I've looked into this and I see that the only difference in the generated HTML by using s={just=c vjust=c} in that case is that each cell in the table has c m data instead of r b data in the html (this is the Jane Height cell):

<td class="r b data">59.80</td>
<td class="c m data">59.80</td>

In SAS, I see the results for each cell being centered instead of right justified (what the c and r imply, I guess). However, in Jupyter (Notebook and Lab) these directives have no effect. In fact, Notebook left justifies all the cells, regardless of cm or rb, and Lab right justifies all the cells, again, regardless of these variations. I've also written the html documents to files (adding the .html extension), and then when I open them they display in a browser with no difference in how they are rendered; all the numerics left justified.

It only seems that SAS's ODS html renderer has any difference with those values in the tags for each cell. Neither Notebook, Lab, nor Chrome have any change in rendering with that minor difference in the tag. I don't think that's a true HTML directive (Not that I really know that much about HTML), but rather something specific to SAS's ODS HTML renderer.

Jupyter's HTML renderer has changed over the years. It's behavior has varied with different releases over the years, and it seem better than it used to be. But, the HTML being created in SAS for this specific case, has no bearing on how it renders this HTML. There's also nothing I could see to do in SASPy itself to try to make this behave differently either. This directive only seems to have any meaning in SAS when rendering ODS itself.

Tom

tomweber-sas commented 1 year ago

Any thoughts? There's nothing I can do to make Jupyter's html renderer honor this metadata that SAS seems to be using for it's rendering. Thanks, Tom

cfkstat commented 1 year ago

The sas output shown by jupyter looks ugly.

tomweber-sas commented 1 year ago

We'll, like I said, I can't control how Jupiter renders html, and their different versions behave differently. If you're still using Notebook, you might try using the newer Lab. It's resolved a number of issues with rendering html compared to earlier Notebook versions. Thanks, Tom