Subscribe Bookmark RSS Feed

Important tip for posting JSL code to this forum

Folks have been having some trouble with JSL code posted not rendering as expected. The problem, it turns out was that browsers were attempting to render parts of the code as HTML.

To get around this issue, enclose your code within HTML style comments. This will cause the browser to ignore any of the content in your code that it might otherwise attempt to render as HTML.

Example
4 REPLIES
alex

Community Trekker

Joined:

Jun 23, 2011

i found that the < and > are the big problems and I've taken to putting in the & l t ; and & g t ;

it would be nice if the forum used markdown....or even better...if they would outsource to stackexchange.com
pmroz

Super User

Joined:

Jun 23, 2011

It is possible to post formatted code and keep the fonts, spacing and colors. Here's an example:



style="font-size: 10pt; font-family: "Courier New"; color: green;">

// Some sample code

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">dt

style="font-size: 10pt; font-family: "Courier New"; color: navy;">=

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">open

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: purple;">"$SAMPLE_DATA/Big
Class.JMP"

style="font-size: 10pt; font-family: "Courier New"; color: black;">)

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">


style="font-size: 10pt; font-family: "Courier New"; color: black;">c

style="font-size: 10pt; font-family: "Courier New"; color: navy;">=

style="font-size: 10pt; font-family: "Courier New"; color: black;">
{}

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">


style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">for

style="font-size: 10pt; font-family: "Courier New"; color: black;">
(i

style="font-size: 10pt; font-family: "Courier New"; color: navy;">=

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: teal;">1

style="font-size: 10pt; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; font-family: "Courier New"; color: black;">
i

style="font-size: 10pt; font-family: "Courier New"; color: navy;"><=

style="font-size: 10pt; font-family: "Courier New"; color: black;">

style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">nrows

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">dt)

style="font-size: 10pt; font-family: "Courier New"; color: navy;">,

style="font-size: 10pt; font-family: "Courier New"; color: black;">
i

style="font-size: 10pt; font-family: "Courier New"; color: navy;">++,

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">
style="">    
c[i]

style="font-size: 10pt; font-family: "Courier New"; color: navy;">=

style="font-size: 10pt; font-family: "Courier New"; color: black;">
dt

style="font-size: 10pt; font-family: "Courier New"; color: navy;">:

style="font-size: 10pt; font-family: "Courier New"; color: black;">height[i]

style="font-size: 10pt; font-family: "Courier New"; color: navy;">*

style="font-size: 10pt; font-family: "Courier New"; color: black;">
dt

style="font-size: 10pt; font-family: "Courier New"; color: navy;">:

style="font-size: 10pt; font-family: "Courier New"; color: black;">weight[i]

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">)

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;

style="font-size: 10pt; font-family: "Courier New"; color: black;">





style="font-size: 10pt; font-family: "Courier New"; color: black;">


style="font-size: 10pt; font-family: "Courier New"; color: rgb(0, 0, 221);">print

style="font-size: 10pt; font-family: "Courier New"; color: black;">(

style="font-size: 10pt; font-family: "Courier New"; color: black;">c)

style="font-size: 10pt; font-family: "Courier New"; color: navy;">;






style="font-size: 10pt; font-family: "Courier New"; color: black;">



Message was edited by: PMroz
pmroz

Super User

Joined:

Jun 23, 2011

This is the thread that shows how to do it:
http://support.sas.com/forums/thread.jspa?messageID=38882韢

Message was edited by: PMroz
I have also encountered problems posting code. In my case the delimiters seemed to work, but only sometimes. I left them there anyways, but it was only after much trial-and-error that I realized that part of the code I was pasting on the post has double quotes

dtf<< Add Filter(columns( :SET ),Where( :SET == YYYY" );
(See original post http://support.sas.com/forums/message.jspa?messageID=51336#51336)<-->

(By the way, I also had issues getting this link to post and not get truncated, and using the delimiters shown was just about the only thing that worked. Is there a way to have the delimiters NOT show up while allowing the text of the link to show?)

Note that in the line above I do NOT have double quotes before YYYY. If I put the double quotes BEFORE YYYY then everything after the double quotes gets deleted. Here is the strange part, I tried putting any character between the equal sign and the double quotes... problem solved but the character (in this case the capital letter T) shows up.
:SET== T "YYYY"

After more goofing around I realized that the combination of TWO equal signs and a double quote was causing the issue.

But things get stranger... in the post I reference above I have the problematic line in question embedded within a paragraph, and in that case there is no truncation of text:

(begin quote)[...]filter would add condition for :SET=="YYYY" while the pre-existing condition :SET=="XXXX" is still in effect.(end quote)

Does anyone know what is going on and why the posted text behaves this way?

Message was edited by: HJvW