Cookies help us display personalized product recommendations and ensure you have great shopping experience.

By using this site, you agree to the Privacy Policy and Terms of Use.
Accept
SmartData CollectiveSmartData Collective
  • Analytics
    AnalyticsShow More
    data driven insights
    How Data-Driven Insights Are Addressing Gaps in Patient Communication and Equity
    8 Min Read
    pexels pavel danilyuk 8112119
    Data Analytics Is Revolutionizing Medical Credentialing
    8 Min Read
    data and seo
    Maximize SEO Success with Powerful Data Analytics Insights
    8 Min Read
    data analytics for trademark registration
    Optimizing Trademark Registration with Data Analytics
    6 Min Read
    data analytics for finding zip codes
    Unlocking Zip Code Insights with Data Analytics
    6 Min Read
  • Big Data
  • BI
  • Exclusive
  • IT
  • Marketing
  • Software
Search
© 2008-25 SmartData Collective. All Rights Reserved.
Reading: From Prettier Tables to Prettier Text
Share
Notification
Font ResizerAa
SmartData CollectiveSmartData Collective
Font ResizerAa
Search
  • About
  • Help
  • Privacy
Follow US
© 2008-23 SmartData Collective. All Rights Reserved.
SmartData Collective > Uncategorized > From Prettier Tables to Prettier Text
Uncategorized

From Prettier Tables to Prettier Text

Editor SDC
Editor SDC
6 Min Read
SHARE

“Pretty” understates what formatting is really about. Making an object more pleasing to the eye is nice, but the point is really about communicating better with the reader of the output. Formatting the output appropriately can improve that process. In previous posts, I have written about ways to format pivot tables: the […]

“Pretty” understates what formatting is really about. Making an object more pleasing to the eye is nice, but the point is really about communicating better with the reader of the output. Formatting the output appropriately can improve that process. In previous posts, I have written about ways to format pivot tables: the most important textual output from SPSS. In this post, I will discuss a way to create and format text blocks.

Inexplicably, SPSS has never had a good, built-in, production way of writing a block of text to the Viewer. Syntax can be echoed to a log file, including the COMMENT command, but logs are full of other things and don’t work well for communicating with readers, especially if they are not conversant with SPSS syntax. You can, of course, interactively insert a text block in the Viewer, but that’s a non-starter for production work. There are scripting apis for text blocks, too, but they require a knowledge of script programming.

For this reason, I created the TEXT extension command. (Recall that extension commands are user-defined commands that can be installed and are then available like regular commands.) TEXT takes a list of literals and creates a new text block object in the Viewer with each literal as a line. You can control the outline text and title information for the block as well. That works with Version 16 or later. With Version 17, though, you can present this text better by adding formatting.

More Read

Current Internet Explorer security flaw even worse than usual ones: Use Firefox or Chrome
What use is BI without fit-for-purpose data?
Is Performance Management the Caterpillar or the Butterfly?
How Craig Kessler Has His Pulse on ROI
Enterprise architect warns: don’t let mashups go the ‘Excel’ route

To do that, all you have to do is to create the text as html or rtf and feed it to the TEXT command. Here’s an example.

TEXT "<html>The following table is " 
"<font size=6><b><i>confidential</i></b> </font>.<br> "
"It must not be shared outside the company</html>"
/OUTLINE HEADING="Notice".

Here’s what the resulting text block looks like.

A Formatted Text Block

A Formatted Text Block

The principle is that if the text looks like html or rtf, it will be treated as formatted text; otherwise, it will be considered to be plain. For html, this means starting with <html> in lower case. This example specifies the “confidential” text to be size 6 (html sizes go from 1 to 7), bold, and italic. It also inserts a line break. A web search on html will produce many pages to explain the html markup language. One good introduction is Introduction to Html.

The text in this example is split into several strings. Because it is formatted, the strings are joined without any added spaces or line breaks. Html directives such as <br> would be used to break lines if needed.

Basic html is simple to write, and there are plenty of free html editors you can use, or just use a plain text editor, but keep the html simple. Only basic formatting is supported. Don’t use Microsoft Word to create the html: it creates very complex and hard-to-process html. For rtf, you might use a program like WordPad to create the rtf and then copy it into your syntax, but rtf is quite complex, and it makes your syntax very hard to read, so I recommend sticking with html.

The TEXT extension command can be downloaded from SPSS Developer Central. It requires the Python programmability Plug-In. The same download works for Versions 16 and 17, but with Version 16, only plain text can be inserted.

Formatting the Outline and Titles

Rather to my surprise, I learned that some users spend a lot of time structuring and formatting the Viewer outline and headings and titles. I created the extension command SPSSINC MODIFY OUTPUT to eliminate the complexity and drudgery in that work.

It’s not well known, but title and heading objects in the Viewer can be formatted with html or rtf in the same way as I just described for text blocks: if the text looks like html or rtf, it is treated that way. The text generated by SPSS procedures, though, doesn’t include such formatting. SPSSINC MODIFY OUTPUT can upgrade the text, and it can do other things to output objects. More on that in my next post.

Share This Article
Facebook Pinterest LinkedIn
Share

Follow us on Facebook

Latest News

crypto marketing
How a Crypto Marketing Agency Can Use AI to Create Powerful Native Advertising Strategies
Blockchain Exclusive Marketing
data driven insights
How Data-Driven Insights Are Addressing Gaps in Patient Communication and Equity
Analytics Big Data Exclusive
image fx (37)
Boosting SMS Marketing Efficiency with AI Automation
Exclusive
pexels pavel danilyuk 8112119
Data Analytics Is Revolutionizing Medical Credentialing
Analytics Big Data Exclusive

Stay Connected

1.2kFollowersLike
33.7kFollowersFollow
222FollowersPin

You Might also Like

Poor Quality Data Sucks

9 Min Read

Beware: You are being watched!

4 Min Read

Marketing Lessons from the Collapse of Lehman Brothers

9 Min Read

Blogs Engage Corporate Stakeholders

4 Min Read

SmartData Collective is one of the largest & trusted community covering technical content about Big Data, BI, Cloud, Analytics, Artificial Intelligence, IoT & more.

data-driven web design
5 Great Tips for Using Data Analytics for Website UX
Big Data
AI and chatbots
Chatbots and SEO: How Can Chatbots Improve Your SEO Ranking?
Artificial Intelligence Chatbots Exclusive

Quick Link

  • About
  • Contact
  • Privacy
Follow US
© 2008-25 SmartData Collective. All Rights Reserved.
Go to mobile version
Welcome Back!

Sign in to your account

Username or Email Address
Password

Lost your password?