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!
Hey @bussql! What is your coding environment and version? SAS Studio, SAS Enterprise Guide, or the SAS VS Code Extension?
I am sing SAS 9.4 (Enhanced editor). Thanks!
Quick follow-up question: When you say SAS 9.4, do you mean the SAS executable (i.e. SAS Enhanced Editor) like this?
Or Enterprise Guide?
I am using SAS 9.4 (Enhanced editor). Thanks!
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.
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.
Triple check your filename.
The second file's shown below has a space between the period and sas in the name.
I try several files but non of them works as expected. Attached file is one example.
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
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.
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!
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.
Ready to level-up your skills? Choose your own adventure.