Hi Communities.
My code which saved in UTF-8 format get garbled when open in SAS EG.
I googled and searched, but don't find any solution to solve this.
Besides, when open this code in SAS DM, it is displayed normally.
You can tell SAS Enterprise Guide to open a file with encoding. File->Open->Program, and then in the file dialog there is a drop down menu on the Open button:
You'll be presented with a long list of possible encoding options.
Usually EG will detect the encoding automatically, but some editors don't always save the proper cues for others to pick it up.
How did you save SAS code as UTF-8? .sas files are plain ASCII.
Hi Kurt,
The code is developed in external editor using UTF-8 encoding.
@ChaseLiu wrote:
Hi Kurt,
The code is developed in external editor using UTF-8 encoding.
Why, in $DEITY's name? What's wrong with the SAS Enhanced Editor?
The fact that you have that problem clearly illustrates the error of your ways.
SAS Enhanced Editor is too slow and outdated compared with those modern IDEs. Neither SAS EG could compare with it.
Besides, Many modern IDEs support customized function which great enchane the productivity.
I do not think it's the way that cause my problems. instead, it's the way SAS EG works.
I never encounter such a problem in traditional SAS.
@ChaseLiu wrote:
SAS Enhanced Editor is too slow and outdated compared with those modern IDEs.
Grmmpf. Too slow? I've never experienced any delay when typing in the EE in EG (the Enhanced Editor in Base SAS and Enterprise Guide is the same, literally the same dll if you have local SAS). Any delay I get is when I send programs for execution over the network, and the runtime of code itself. And in what aspect is the EE "outdated"?
What I said 'Slow', I mean developing code is slow.
I'm here to find a solution rather than argue with such a question. If you think SAS is not outdated, then be it.
How did you open the code in SAS DM? Do you work across platforms (eg SAS with DM on UNIX, EG (naturally) on Windows)?
Seeing what you are doing in your code, one workaround (and significant improvement of the code) would be to store the lookup in a dataset, create a format dynamically from that, and use that format in a single put statement instead of that long if-then-else chain. That would remove the special UTF characters (which I guess are part of the strings) from the code.
And anytime you have a if-then-else chain, look at the select data step statement. Won't solve your immediate problem, but makes code more readable.
Hi Kurt,
Thanks for your suggestion, I think your advice would be a work around. But I do not think this is a long-term solution.
What confused me a lot is that while I can open code normally in PC SAS but not in EG. This is very weird and I think there should have some ways to work out.
Is there a setting in Enterprise Guide to tell it to use UTF-8 encoding?
This is exactly what I'm asking.
while I'm using EG in windows environment, it seems that EG default the encoding to windows default encoding.
You can tell SAS Enterprise Guide to open a file with encoding. File->Open->Program, and then in the file dialog there is a drop down menu on the Open button:
You'll be presented with a long list of possible encoding options.
Usually EG will detect the encoding automatically, but some editors don't always save the proper cues for others to pick it up.
What version of EG does that menu appear? I do not see it in 6.1 M1HF5 (6.100.0.4180) (64-bit)
Hi @Tom - it was added a long time ago, I think in EG 5.1.
2 step process depicted:
Are you opening your .sas program through your local file system or through the SAS server (Files location)? Have you tried saving your .sas file in UTF-8 with a byte order mark (BOM) to see if that allows EG to discover the encoding?
Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF
View now: on-demand content for SAS users
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.