- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi everyone,
I'm experiencing an issue with indentation in SAS Enhanced Editor. I manually indent my code using spaces instead of tabs, but whenever I reopen a SAS program, random extra spaces are added to my code. The number of added spaces is inconsistent—some lines get one extra space, while others get six or seven. When I delete these (using backspace or delete keys), sometimes it will delete the entire space in one go, but not always.
This only happens to the sections of code that I have written, even in programs where multiple programmers have contributed. It’s becoming very time-consuming to fix the indentation every time I open a program.
I'm using SAS 9.4 (M5) - 64-bit. Has anyone else experienced this issue, or does anyone know how to prevent SAS from modifying my indentation?
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Make sure you have told the editor to NOT put tabs into the file.
If you already have that then perhaps someone else has edited the file and replaced the spaces with tabs?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi, these are my settings currently. Would it be 'Replace tabs with spaces on file open'? It isn't to do with anyone else editing the files as I have just tested it with a colleague who didn't edit anything and the same issue occurred.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
With those setting if you hit the TAB key on your keyboard the editor will actually put a physical '09'x character into the file.
And if you open a file to edit that has physical tabs that were inserted using some other setting than 2 as the width of the tab stops then it will look funny.
Having actual physical tab characters in your file can cause all kinds of confusion after just a few simple edits.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@bizbaz20 wrote:
Hi everyone,
I'm experiencing an issue with indentation in SAS Enhanced Editor. I manually indent my code using spaces instead of tabs, but whenever I reopen a SAS program, random extra spaces are added to my code. The number of added spaces is inconsistent—some lines get one extra space, while others get six or seven. When I delete these (using backspace or delete keys), sometimes it will delete the entire space in one go, but not always.
The highlighted text above indicates that TAB characters are in the file.
Note that the SAS auto indent will use tabs (which your editor settings can be made to save as spaces) even if you typically use the space key.
And if multiple people are editing the files then different settings of the editors for number of spaces a tab represents might come into play.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@ballardw wrote:...
Note that the SAS auto indent will use tabs (which your editor settings can be made to save as spaces) even if you typically use the space key.
...
There are two options you can set in the Enhanced Editor to manager this behaviour.
Selecting the first makes SAS do the opposite of what you say. When you type the TAB key spaces are inserted into the file instead of an actual TAB character.
The second controls what happens when you open an existing file. When selected existing tabs are replaced by spaces so that you can edit the file without worrying that copying text will cause tabs to appear in unwanted places.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for explaining those options. I have now ticked both options and turned off automatic indentation. It hasn't happened since, but I will check some of my programs tomorrow.
I checked my original settings against my colleagues, and they both match. Nor have they edited or opened the scripts in question, so I don't think it relates to other people editing it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Not sure where SAS stores that EE settings.
But for normal preferences they are stored in the SASUSER.PROFILE catalog. And if you are running multiple SAS sessions without using the -RSASUSER option on startup then the 2nd,3rd,etc. sessions will not be able to open SASUSER.PROFILE. So you end up getting a default profile instead of your persona; preferences. That might change the tab spacing from 2 to 8 and cause a file with mix of tabs and spaces to look funny.