BookmarkSubscribeRSS Feed
Autotelic
Obsidian | Level 7

 This issue happens on Jupyter Notebook using sas_kernel.

 

Proc SQL inobs=20;

Select * from have;
Quit;

The code above outputs a table in which data overlaps as in shown below:

 

overlap.JPG

I would like to outfit every column to the max between the header length and the data length. I don't want to define this manually for every column.

How do I do this?

 

Thanks.

4 REPLIES 4
Shmuel
Garnet | Level 18

Try to increase OPTIONS  LineSize= ...;

ballardw
Super User

What destination are you printing to? What application is that screen shot from?

 

When your code says cellwidth=1in then that is what you get, a cell of one inch width. You could take a pass through your data calculating the maximum number of characters per column, estimate a width using that information, stuff that into a bunch of macro variables and use those instead of literal 1in or similar values.

 

BUT if you are writing to a spreadsheet then the width of a specific cell may well be controlled by something well before the cell you are looking at.

Also if you are using a destination that actually has page widths such as RTF or PDF then your defined column widths may make the table split in some odd manner.

Autotelic
Obsidian | Level 7

What destination are you printing to? What application is that screen shot from?

I'm using jupyter notebook connected to SAS, but I'm hoping that isn't relevant.

When your code says cellwidth=1in then that is what you get, a cell of one inch width. You could take a pass through your data calculating the maximum number of characters per column, estimate a width using that information, stuff that into a bunch of macro variables and use those instead of literal 1in or similar values.

I understand the implications of cellwidth=1in, I should have used another code. I've updated the question to remove this issue.

ballardw
Super User

I have zero experience with Jupyter but I suspect that has a big part in this appearance as I can't generate any output like that in HTML, Listing, RTF of PDF. Many years ago I did make similar output using the OVERPRINT options with PUT statements when writing to a printer or embedding codes in data to make a printer do that.

 

It might help to provide a small data set and any other options you are using to see if any other Jupyter users have suggestions.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1229 views
  • 0 likes
  • 3 in conversation