BookmarkSubscribeRSS Feed
bussql
Calcite | Level 5

Dear All,

 

I would like to see the syntax with automatic colors. But when I open a sas script, the automatic coloring syntax does not work (All texts are in black). For example, File -> Open program

 

PROC IMPORT
DATAFILE="C:\Users\bussql\Downloads\erp_public_coefs_annual_240107.dta"
OUT=SASDatasetName
DBMS=dta REPLACE;
RUN;

 

But when I type the command editor (File -> New program) then automatic coloring works properly. 

 

I do not know why. Your help to sort out this issue is appreciated. Thanks!

 

 

 

 

10 REPLIES 10
Stu_SAS
SAS Employee

Hey @bussql! What is your coding environment and version? SAS Studio, SAS Enterprise Guide, or the SAS VS Code Extension?

bussql
Calcite | Level 5

I am sing SAS 9.4 (Enhanced editor). Thanks!

Stu_SAS
SAS Employee

Quick follow-up question: When you say SAS 9.4, do you mean the SAS executable (i.e. SAS Enhanced Editor) like this?

Stu_SAS_0-1744741495288.png

 

 

Or Enterprise Guide?

Stu_SAS_0-1744741344653.png

 

 

 

 

 

bussql
Calcite | Level 5

I am using SAS 9.4 (Enhanced editor). Thanks!

Quentin
Super User

Any chance your SAS program does not have a .sas extension?  In Display Manager (PC SAS), if I use File-> Open Program to open myprogram.txt it will not syntax highlight it. 

bussql
Calcite | Level 5

Thank you for your reply. But it is so strange to me. My script file has a *.sas extension, not .txt. The thing is when I copy the code lines and past them to a new editor window then the syntax colors look normally as expected.

Tom
Super User Tom
Super User

Triple check your filename.

The second file's shown below has a space between the period and sas in the name.

Tom_0-1744748722808.png

 

bussql
Calcite | Level 5

I try several files but non of them works as expected. Attached file is one example.

mharding
SAS Employee

Hi, 

As previously suggested by others, it appears the editor is not recognizing the program.  Since you mentioned that if you copy the code into a new program window it shows the Enhanced editor colors.  Have you tried saving that program and then opening the new one.    

 

Perhaps there are some unusual characters in the original program that are preventing SAS from understanding the text.   Thanks,

Mary

 

Tom
Super User Tom
Super User

That file looks fine to me.

Try renaming it.

 

Here is picture of it working fine on my machine.

Also another example of a file that looks like it ends with .sas but really it has a non-breaking space at the end.  SAS also does not think that is a SAS program file.

Tom_0-1744815796705.png

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 10 replies
  • 1281 views
  • 2 likes
  • 5 in conversation