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

sas proc report subscript effect not working properly #561

Closed tszjqgs closed 8 months ago

tszjqgs commented 9 months ago

what I expect to get is

WXWorkCapture_16958905051624

what I get now in saspy is

WXWorkCapture_16958907337274

code is

image WXWorkCapture_16958907846103

pretty or not is another story , but need to get the subscript correct, thank you in advance Tom my environment is sas local , saspy 5.3.0 ,sas version 9.04.01M7P08052020 , windows 10 platform , Python 3.11.3 | packaged by Anaconda, Inc. | (main, Apr 19 2023, 23:46:34) [MSC v.1916 64 bit (AMD64)] Type 'copyright', 'credits' or 'license' for more information IPython 8.12.0 -- An enhanced Interactive Python. Type '?' for help.

tomweber-sas commented 9 months ago

What does the html look like if you just open the output file in a browser or any other HTML viewer, as opposed to in jupyter (I'm assume this is Jupyter?)? I've tried to code up a similar proc report, but I'm not getting anything like you're seeing. I don't know proc report, so I'm not sure how to simulate your case specifically. The two thoughts I have, not really knowing how to reproduce this is that I've seen problems with Jupyter displaying HTML output like this before where it should have a horizontal scroll bar since the width is wider than the window, but it didn't; it squished everything into a fixed width. The output looked like what you showed. The other thing is with the code where you seem to be explicitly defining the widths and such. Again, I'm not familiar with using proc report so I don't know what the expectation is. So, if you can compare viewing the report.html with different viewers (browser, jupyter, regular SAS session, other if you have it), then we can at least see about the first thought. If it looks the same everywhere, maybe all of the explicit sizes are causing it to overlap? That's the one I'm not sure about how to reproduce at the moment, but I'll continue to play with it to see. If you can reproduce this with a data set from the sashelp library, I could use that code to test it out.

Thanks, Tom

tomweber-sas commented 9 months ago

ok, I was able to come up with something that exhibits the first case I was mentioning. I used the cars data set and tried to do similar to what you're doing. In Jupyter it squishes the report while the actual html file rendered in a browser renders correctly. So, I'm curious if you see the same thing.

image image

tomweber-sas commented 9 months ago

And to speak to the second case I was wondering about. I removed the hard coded widths and the output rendered better, though Jupyter ought to allow the width to be larger than the screen and allow horizontal scrolling. Here are two after removing the hard coded widths, the first the same as what I showed before, where it's squished. The second just making the browser window wider. Note that the output above that's squished (with hard coded widths), doesn't change when I widen the browser window. So, both of the two cases I mentioned are playing into this with Jupyter.

remove hard coded widths image

widen the window itself and things spread out now that there's room image

with hard coded widths (from previous post) widening the window doesn't matter image

tszjqgs commented 9 months ago

Thanks Tom , I will check if read from html browser will have what I need , what I was saying is about this following

https://en.wikipedia.org/wiki/Subscript_and_superscript

partial of the letter should be in the other way around of exponential position. (example , AUC0-t , this 0-t portion is not only in lowercase , but the whole part is in subscript )

tomweber-sas commented 9 months ago

Are you saying that you're expecting the stings you're providing as the column labels, to be formatted as subscripts? All I see is you just get the string you coded. I don't see anything in the proc report doc saying anything about apecial syntax in that string to generate subscripts or superscripts; https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/p0wy1vqwvz43uhn1g77eb5xlvzqh.htm#p0mayreinwul0pn10rgmw97u9lrh

I typed in something similar to what you have for column labels in this one, removing extra columns so we can see the output clearly.

image

The label is just the string that's coded; no kind of special formatting is being done.

Or am I still missing something here. Your output from the initial post here just looks like what you typed in as the string itself, same as mine. So maybe I'm still missing something.

tszjqgs commented 9 months ago

@tomweber-sas Hi Tom ,yes , there are something missing , the highlighted script ^{sub max} was for the purpose of being able to display max as a subscript ,not a common lower case "max" (it is a traditional reporting practice is pharmaceutical industry), but the output did not factor that into the result . which was not the case in my desktop SAS environment ,"sub" is a keyword , not supposed to be in the output . so am not sure if it is Jupyternote book issue , or saspy issue

tomweber-sas commented 9 months ago

Can you show me the code you're running in SAS and the output, where this does what you expect? Can you show the part of the output file that has those headings too? For instance, here's the part of the html output that contains the sting in question, which is just a string, not html directives. Which is also why it's just that sting in the output, not what you're looking for. I don't see anything about this that would cause it to do what you're looking for. The SAS proc report doc just shows this label field as a string you provide. I don't see anything about using functions or directives w/in it to cause that kind of thing. But again, I'm not familiar with it, so if it's doing that somewhere else then I need to see what's actually happening.

Thanks, Tom

</style>
</head>
<body class="l body">
<div style="padding-bottom: 8px; padding-top: 1px">
<div id="IDX" class="systitleandfootercontainer" style="border-spacing: 1px">
<p><span class="c systemtitle">The SAS System</span> </p>
</div>
<div style="padding-bottom: 8px; padding-top: 1px">
<div style="padding-bottom: 8px; padding-top: 1px">
<table class="table" style="border-spacing: 0; width: 80%" aria-label="Detailed and/or summarized report">
<caption aria-label="Detailed and/or summarized report"></caption>
<colgroup><col/><col/><col/><col/></colgroup>
<thead>
<tr>
<th id="ch1b1b1a" class="c b header" scope="col">Make</th>
<th id="ch1b1b2b" class="c b header" scope="col">Model^{sub max} ^n{h}</th>
<th id="ch1b1b3c" class="c b header" scope="col">Type</th>
<th id="ch1b1b4d" class="c b header" scope="col">Orig</th>
</tr>
</thead>
<tbody>
<tr>
<th id="rh1b1b1" class="t data" headers="ch1b1b1a" rowspan="7">Acura</th>
<th id="rh1b1b2" class="c t data" headers="ch1b1b2b rh1b1b1">3.5 RL 4dr</th>
<th id="rh1b1b3" class="c t data" headers="ch1b1b3c rh1b1b1 rh1b1b2">Sedan</th>
<td class="c t data" headers="ch1b1b4d rh1b1b1 rh1b1b2 rh1b1b3">Asia</td>
</tr>
tomweber-sas commented 9 months ago

trying the same code in SAS does the same thing for me. If this works somewhere, do you just have the wrong syntax or something?

image

tomweber-sas commented 8 months ago

Hey @tszjqgs can you provide anything that shows these characters in the label string cause formatting anywhere? Or show me where it is that something says this is supposed to do what you're looking for? The Proc Report doc has nothing in it I see about this. SAS doesn't produce the output you're looking for; it's the same output I get from SAS in saspy. That syntax isn't anything I've see in SAS before, so I just can't find anything to show that it should do anything special. Is it some other language you've used where that string causes formatting? Thanks, Tom

tomweber-sas commented 8 months ago

I'm going to close this. I can't find any way that this is a bug. Just that it's not valid syntax for SAS, in the place you're trying to use it, if it's valid anywhere. If you have any information that can help, feel free to reopen it.

Thanks! Tom