BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
LenFocus
Calcite | Level 5

Hi,

 

I have created a multi-line prompt input inside SAS EG. 

 

multiline_prompt.png

 

After receving the input, I tried to output to the report via ODS statement.

ods text = "^{style [color=#808080 fontfamily='<serif> , <MTserif> , Times' fontsize=9PT LEFTMARGIN=1.5cm]■}^{style [color=black fontfamily='<serif> , <MTserif> , Times' fontsize=9PT]       &highlights }";

However, the line break seems to be missing inside the report.

multiline_prompt_output.png

Is there any way to add back the link breaks to the report?

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
BrunoMueller
SAS Super FREQ

Hi

 

Linebreaks are not preserved by the multi-line prompt.

 

As a possible workaround I suggest to use a prompt definition like this:

Capture.PNG

 

This will give you an individual macro variable for each line. See part of the log below. The name of the prompt used in this example is MULTILINE.

 

32         %put _user_;
GLOBAL MULTILINE line1
GLOBAL MULTILINE0 2
GLOBAL MULTILINE1 line1
GLOBAL MULTILINE2 line2
GLOBAL MULTILINE_COUNT 2

You can then use the individual macro variables to put together your text that you need. I agree not the most elegant way, but might be a possible workaround.

 

This is an example code to handle the multiple macro variables


%macro generateText;
  %local i;
  %global newMultiline;
  %let newMultiline =;

  %if &MULTILINE_COUNT = 1 %then %do;
    %global MULTILINE1;
    %let MULTILINE1 = &multiline1;
  %end;

  %do i = 1 %to &MULTILINE_COUNT;
    %let newMultiline = &newmultiline.^{NEWLINE}&&multiline&i;
  %end;
%mend;

%generateText

ods escapechar="^";
ods text="&newMultiline";

proc print data=sashelp.class;
run;

 

Bruno

 

 

View solution in original post

2 REPLIES 2
BrunoMueller
SAS Super FREQ

Hi

 

Linebreaks are not preserved by the multi-line prompt.

 

As a possible workaround I suggest to use a prompt definition like this:

Capture.PNG

 

This will give you an individual macro variable for each line. See part of the log below. The name of the prompt used in this example is MULTILINE.

 

32         %put _user_;
GLOBAL MULTILINE line1
GLOBAL MULTILINE0 2
GLOBAL MULTILINE1 line1
GLOBAL MULTILINE2 line2
GLOBAL MULTILINE_COUNT 2

You can then use the individual macro variables to put together your text that you need. I agree not the most elegant way, but might be a possible workaround.

 

This is an example code to handle the multiple macro variables


%macro generateText;
  %local i;
  %global newMultiline;
  %let newMultiline =;

  %if &MULTILINE_COUNT = 1 %then %do;
    %global MULTILINE1;
    %let MULTILINE1 = &multiline1;
  %end;

  %do i = 1 %to &MULTILINE_COUNT;
    %let newMultiline = &newmultiline.^{NEWLINE}&&multiline&i;
  %end;
%mend;

%generateText

ods escapechar="^";
ods text="&newMultiline";

proc print data=sashelp.class;
run;

 

Bruno

 

 

LenFocus
Calcite | Level 5

Thanks Bruno. It works nicely. Smiley Very Happy

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 2 replies
  • 2428 views
  • 0 likes
  • 2 in conversation