3
votes

I just started using notepad++ to edit SAS codes and found my current userDefineLang_SAS.xml configuration cannot properly fold SAS code blocks from "proc" to "run".

Here is my sample code in notepad++:

1 /*sample code*/
2 proc sort data=orion.usorders04
3           out=work.sort_usorders04;
4    by Customer_ID Order_Type;
5 run;
6
7 data discount1 discount2 discount3;
8     set work.sort_usorders04;
9     by customer_id order_type;
10    if first.order_type = 1 then totalsales=0;
11    totalsales + total_retail_price;
12    if last.order_type =1 and totalsales >= 100 then
13        do;
14            if order_type = 1 then output discount1;
15        if order_type = 2 then output discount2;
16        if order_type = 3 then output discount3;
17       end;
18    keep customer_id customer_name totalsales;
19    format totalsales dollar11.2;
20 run;

As what I have expected, I hope that line 2 to line 5 will be folded together. However it doesn't fold as I expected and instead line 2 to line 20 are folded together. See the example image in this link:

https://drive.google.com/file/d/0B3-WolEQUW6ydHJ6Z3RxTEpRZlE/edit?usp=sharing

Interestingly, if I take out "data=" in the proc sort code, line 2 to line 5 can be folded together. See example image using this link:

https://drive.google.com/file/d/0B3-WolEQUW6ydFo3ZmNyODlZUnM/edit?usp=sharing

Since in the .xml file, both "data" and "proc" are specified as the opening keywords to fold a code block, it confuses notepad++ when both proc & data are shown in the proc sort code. I have been trying many ways to adjust the configuration in the .xml file, but all doesn't work. If you have a way to figure this out please let me know. Thanks!

1
This one may be best reported to the Author of N++AlG
I've also hit this problem and am unable to find a fix - if you found one please let me know!Ewanw
If you're okay with folding procedures and not data steps then you can change data from a folding keyword to a regular keyword.Alex A.

1 Answers

1
votes

I had this problem and after much tinkering I found something that worked for me. I am not sure how your full language is defined, but putting data= as the middle criteria on the folding in code 1 section works for my situation:

Folding SAS Lines