We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Syntax highlighting for a SAS code

Hello,

I'm evaluating your product to see if it can be used to write a commercial SAS editor. Is it possible to highlight the following variants of a SAS code (keywords: data, run):

(1) Variation 1 (collapsible, priority 1, with "run;" statement as end of block)

data mydata;
...line of code 1
...line of code 2
run;

(2) Variation 2 (collapsible, priority 2, no "run;" statement; last statement ends the block)

data mydata;
...line of code 1
...line of code 2

Thanks, Audi






12 Replies

AD Administrator Syncfusion Team July 30, 2008 01:54 PM UTC

Hi Audi,

Sorry for the delay response.

It is possible to highlight the variants of SAS code.

Please refer the code below for Variation 1:








txt


IsCollapsable="true" CollapseName="(...)" AllowTriggers="false" Priority="0">







data
run;




Please refer the below sample for more detail.
http://websamples.syncfusion.com/samples/edit/F75411/main.htm

Please refer the tutorial link for more detail:
http://help.syncfusion.com/UG/User%20Interface/Windows%20Forms/Edit/Documents/411creatingacustomlanguageconfigurationfile.htm
http://help.syncfusion.com/UG/User%20Interface/Windows%20Forms/Edit/Documents/45syntaxhighlightingandcodecoloring.htm

Variantion 2:

Without run its automatically collapse to last available token. This is default behavior. if there is no EndBlock, the lexem will not be closed until it's find the end token.

Please let me know if any concern.

Regards,
Hema





AD Administrator Syncfusion Team August 1, 2008 07:46 PM UTC

Hi Hema,

Thank you for your sample code! I have some follow-up questions:

(1) I have a two-word beginning of a block, with same first word ("proc") but with a variable second word (varies according to the name of the procedure). For example:

proc report data=mydata;
...lines of code;
run;

proc means data=mydata;
...lines of code;
run;


I want "proc report" and "proc means" (including the end of block "run;") to be in dark navy blue color. I tried the following regex pattern but it doesn't work:

"proc\s+\w{1}"

Could it be because the line where "proc" starting block begins contains other codes after the procedure name?

(2) Is there a workaround to the default behavior of automatically collapsing to last available token when there is no end block? (like not collapsing when the collapse/expand icon is clicked)

Thank you in advance!

Regards, Audi



>Hi Audi,

Sorry for the delay response.

It is possible to highlight the variants of SAS code.

Please refer the code below for Variation 1:








txt


IsCollapsable="true" CollapseName="(...)" AllowTriggers="false" Priority="0">







data
run;




Please refer the below sample for more detail.
http://websamples.syncfusion.com/samples/edit/F75411/main.htm

Please refer the tutorial link for more detail:
http://help.syncfusion.com/UG/User%20Interface/Windows%20Forms/Edit/Documents/411creatingacustomlanguageconfigurationfile.htm
http://help.syncfusion.com/UG/User%20Interface/Windows%20Forms/Edit/Documents/45syntaxhighlightingandcodecoloring.htm

Variantion 2:

Without run its automatically collapse to last available token. This is default behavior. if there is no EndBlock, the lexem will not be closed until it's find the end token.

Please let me know if any concern.

Regards,
Hema







AD Administrator Syncfusion Team August 5, 2008 10:45 AM UTC

Hi Audi,

Thank you for your patience.

We can able to change the color of the word.

Please refer the below code snippet for changing the color of word.





2. To avoid the behavior of collapsable, set the false to IsCollapsable property. Please refer the below code for your reference.


Please refer the modified sample as per your requirement.
http://websamples.syncfusion.com/samples/edit/F75411_2/main.htm

Please let me know if any concern.

Regards,
Hema




AD Administrator Syncfusion Team August 5, 2008 02:40 PM UTC

Hi Hema,

Thank you for your response. Unfortunately, they were not exactly what I wanted:

(1) I wanted to highlight a two-word startblock, with the second word varying according to the name of the procedure. For example:

proc means data=mydata;
...lines of code;
run;

proc report data=mydata;
...lines of code;
run;

Here, the startblocks are "proc means" and "proc report", both with an endblock "run;". How do you highlight the two-word startblock with a regex pattern? I tried the pattern

"proc\s+\w{1}\s+.*"

but it doesn't work.


(2) How do you turn off collapsing when the endblock "run;" is not used?

Thanks, Audi



AD Administrator Syncfusion Team August 11, 2008 01:35 PM UTC

Hello,

Our decision to buy this control will depend on the ability to implement the cases described in the previous post, especially the ability to highlight a two-word startblock (or beginning block) when the second word is variable. There are more than a hundred possible second words, corresponding to SAS procedure names). It is very inconvenient to create a lexem for each of them.

Thanks, Audi

>Hello,

I'm evaluating your product to see if it can be used to write a commercial SAS editor. Is it possible to highlight the following variants of a SAS code (keywords: data, run):

(1) Variation 1 (collapsible, priority 1, with "run;" statement as end of block)

data mydata;
...line of code 1
...line of code 2
run;

(2) Variation 2 (collapsible, priority 2, no "run;" statement; last statement ends the block)

data mydata;
...line of code 1
...line of code 2

Thanks, Audi









AD Administrator Syncfusion Team August 14, 2008 04:10 PM UTC

Hello, may I have your confirmation that the cases I have described previously cannot be implemented using the Syncfusion Edit control?

Thanks, Audi



AD Administrator Syncfusion Team August 18, 2008 04:57 AM UTC

Hi Audi,

Sorry for the delay.

It is possible to Highlight the Two word contruct using the following Lexem definition[regex pattern]. Please refer the below code snippets.

[C#]







...
...

proc\s\w+


Please refer the below sample for you reference.
http://websamples.syncfusion.com/samples/Edit/75411_3/main.htm


It is not possible to Disallow collapsible for same lexem definition with and without EndBlock with the current architecture of EditControl.

Please let me know if any concerns.

Regards,
Hema





AD Administrator Syncfusion Team August 18, 2008 11:54 AM UTC

Hema, excellent! I'll try highlighting other SAS language constructs and see if they can be done using this control. Very promising so far!

Thanks a lot for your help.

Regards, Audi :-)



AD Administrator Syncfusion Team August 18, 2008 12:34 PM UTC

Hi Audi,

Thank you for the update.

Regards,
Hema



AD Administrator Syncfusion Team August 18, 2008 09:54 PM UTC

Hi Hema,

Attached shows a SAS language construct involving data blocks that begin with the statement "datalines;" or "datalines4;", and ending with one semicolon ";" or 4 semicolons ";;;;", respectively. For example:

data one;
set two;
datalines;
1 2 3 4
6 7 8 9
;
run;

data one;
set two;
datalines4;
1 2 3 4
6 7 8 9
;;;;
run;

What appropriate lexem would highlight the data rows "1 2 3 4" and "6 7 8 9" with a backcolor of light yellow?

Thanks for your help!

Audimar



sas_datalines_879b22de.zip


AD Administrator Syncfusion Team August 20, 2008 10:01 AM UTC

Hi Audi,

Sorry for the delay,

It is possible to Hightlight the SAS language construct involving data blocks that begin like "datalines;" or "datalines4;" following lexem definition, Please refer the below code snippets.

[C#]




....

IsCollapsable="true" CollapseName="(...)" AllowTriggers="false" Priority="0">





IsCollapsable="true" CollapseName="(...)" AllowTriggers="false" Priority="0">








proc\s\w+
data
run;
[0 -9]{7}

datalines\W
datalines\w



Please refer the sample for your reference and let me know if this meets your requirement.
http://websamples.syncfusion.com/samples/Edit/F75411_4/main.htm

Please let me know if any concerns.

Regards,
Hema




AD Administrator Syncfusion Team August 21, 2008 01:46 AM UTC

Hi Hema -- great! So far so good (thanks!). :-)

I'm now going to explore the IntelliSense feature of this control, and will post here if I run into a problem.

Thanks again, Audi


Loader.
Live Chat Icon For mobile
Up arrow icon