BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Im a newbie, so please be gentle when replying. I'm simply trying to implement a Line break between comment lines when outputting to HTML. Before i put handling in to ignore blank lines, when all cmmt* fields were blank, it would correctly use the <br>'s. However when some data exists, it outputs the <br>'s as & lt ;br& gt ;..(spaces put in intentionally so that it doesnt format them to symbols) does anyone have an easy solution?
[pre]
PROC SQL;
CREATE TABLE WORK.QRY1 AS SELECT
A.Date FORMAT=DDMMYY8.0,
A.Nbr,
(A.cmmt1 || ifc(A.cmmt2="","",'<br>') ||
A.cmmt2 || ifc(A.cmmt3="","","<br>") ||
A.cmmt3 || ifc(A.cmmt4="","","<br>") ||
A.cmmt4 || ifc(A.cmmt5="","","<br>") ||
A.cmmt5 )
as cmmt label "Comments",
FROM Table1 as A
ORDER BY A.Nbr;
QUIT;

ods html file = _webout ;

TITLE;
Title1 Merged Comments
Title2 ;
proc print data = WORK.QRY1 noobs label ;
quit;
ods html close;
[/pre]

Message was edited by: Paat Message was edited by: Paat
7 REPLIES 7
deleted_user
Not applicable
i found this in another thread on here, which seems to fix the immediate problem, but raises another.. i've now lost my style formatting...

ods html file = _webout stylesheet=(url="/_Style/SStyle.css");


proc print data = WORK.QRY1 noobs label style(column)=[protectspecialchars=off];
quit;
Cynthia_sas
SAS Super FREQ
Hi:
Protectspecialchars=off allows the browser to see the <br> as a valid HTML Break tag. So it would not necessarily "alter" your style formatting.

The special fileref that you use: _WEBOUT indicates to me that you are either using SAS/IntrNet or have written a SAS Stored Process (for use in the Enterprise Intelligence Platform.

Debugging your style issue will depend on which one of those 2 references for _WEBOUT is the one you are using. And, if you are using _WEBOUT with a stored process, the solution may be affected by which client application you are using to execute the stored process. For example, with the SAS Add-in for Excel and/or PowerPoint-- the default result type for a stored process is SASReport XML -- which does not use any of your style information -- unless you do something special to turn on style usage.

If you are using SAS Web Report Studio, styles and _webout do not generally work the way they do in other client applications. If you are using the Stored Process Web Application to submit the stored process, the URL that you show is a relative path FROM the path you gave when invoking the URL for stored process execution. The stylesheet= option that works with EG, for example, is probably not the correct stylesheet= option for either of the 2 usage scenarios.

Tech Support can determine which usage scenario you are operating with and can help you with the correct syntax for your platform and installation specifics.

cynthia
deleted_user
Not applicable
Hi Cynthia.

I dare say its the stored process way, as i have to create a stored process for each "application" i write. Aside from that i'm not really sure (spot the newbie!) ?!

The application is solely for use on a web browser, IE, on the company intranet.

Before i added in the protectspecialschars=off option, the stylesheet was working perfectly. If i remove the protectspecialchars=off the stylesheet returns and formatting is correct on the table. So i cannot see it being a path issue, as it works until the addition of the protectspecialchars=off. I should note that the formatting ONLY changes for the columns of the table... everything else remains formatted correctly for the stylesheet provided.

Any futher help would be greatly appreciated.
Cynthia_sas
SAS Super FREQ
Hi...well, that's very interesting behavior. I thought that protectspecialchars=off did not affect anything other than the HTML tags in your variable values or labels or titles.

In that case, my guess would be that it's something with the tagset and tagset template that's being used for ODS HTML -- and some unforseen interaction with PROTECTSPECIALCHARS=OFF. But that's just my guess.

Tech Support could help you track it down for sure.

cynthia
deleted_user
Not applicable
Tried to create a ticket, but it returns a "page not found" on the final step.. WIll try again later.

thanks for your help.
deleted_user
Not applicable
FYI: solved this one thinking outside the box.

heres what i did.

[pre]
PROC SQL;
CREATE TABLE WORK.QRY1 AS SELECT
A.Date FORMAT=DDMMYY8.0,
A.Nbr,
"<SPAN>" ||
(A.cmmt1 || ifc(A.cmmt2="","",'<br>') ||
A.cmmt2 || ifc(A.cmmt3="","","<br>") ||
A.cmmt3 || ifc(A.cmmt4="","","<br>") ||
A.cmmt4 || ifc(A.cmmt5="","","<br>") ||
A.cmmt5 ) || "</SPAN>"
as cmmt label "Comments",
FROM Table1 as A
ORDER BY A.Nbr;
QUIT;
ods html file = _webout ;
TITLE;
Title1 Merged Comments
Title2 ;
proc print data = WORK.QRY1 noobs label ;
quit;
ods html close;
[/pre]

For whatever reason, if i start the content with HTML "code" then Sas renders it correctly.. strange!?! Message was edited by: Paat
Cynthia_sas
SAS Super FREQ
Hi:
Something similar used to happen in either 8.2 or early versions of 9 -- but you would only lose the tag in the title or footnote. You got rid of the problem by using the <DIV> tag. It used to happen in the TITLE and this is the way you fixed it:
http://support.sas.com/faq/033/FAQ03383.html

Good job thinking outside the box!

cynthia

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