BookmarkSubscribeRSS Feed
twildone
Pyrite | Level 9

Hi...I am trying to insert a Error Message when a dataset has no records. I am creating a pdf file and would like to be able to format the text message so that it is left justified and continues onto the next line without breaking within a word. For example, right now it end the first line with "Janu" and continues onto the second line with "ary". Would like it to resemble the same format as if it would be typed in a Word document. Any help would be greatly appreciated....Thanks.

DATA _NULL_;

IF &nobs = 0 THEN DO;

FILE PRINT;

PUT "A query for the Purchase History for Client, John Smith, for the period of January 1, 2014 to December 31, 2014 has revealed that no purchases have been made for this client during this time period.";

END;

STOP;

RUN;

1 REPLY 1
ballardw
Super User

With Put statements you need to control everything, including line counts and such. You could use multiple Put statements but changes to the output format or document properties may not look very good.

Or try File Print ODS and Put _ods_;

I would be very tempted to see if I could get an ODS Text statement to work.

I don't use PDF much but with RTF this would work.

ods text="A query for the Purchase History for Client, John Smith, for the period of January

1, 2014 to December 31, 2014 has revealed that no purchases have been made for this

client during this time period.";

Would work. For readability in a code editor I would break the line at which point you want a blank space at the beginning of each line for the ODS processor to put a space in the right spot. Also you may get a message about "current quote exceeds ..."

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1 reply
  • 836 views
  • 0 likes
  • 2 in conversation