BookmarkSubscribeRSS Feed
novinosrin
Tourmaline | Level 20

How to format code in PC SAS? We don't seem to have a code format right click option in PC SAS.

 

Manual formatting is so boring and annoying particularly for lazy folks like me, and poor formatted code (mine) gives me enormous eye strain.

 

Is there an alternative?  

 

 

5 REPLIES 5
Reeza
Super User

Not AFAIK, I often open EG or SAS Studio for that reason, copy code there format and paste back 😄

 


@novinosrin wrote:

How to format code in PC SAS? We don't seem to have a code format right click option in PC SAS.

 

Manual formatting is so boring and annoying particularly for lazy folks like me, and poor formatted code (mine) gives me enormous eye strain.

 

Is there an alternative?  

 

 


 

SASKiwi
PROC Star

It is also highly unlikely that this legacy SAS interface will get any major enhancements like this in the future as it is very much just being maintained as is. SAS EG and SAS Studio are now the interfaces getting all of the improvements.

ballardw
Super User

@SASKiwi wrote:

It is also highly unlikely that this legacy SAS interface will get any major enhancements like this in the future as it is very much just being maintained as is. SAS EG and SAS Studio are now the interfaces getting all of the improvements.


Smiley SadSmiley SadSmiley Sad

 

novinosrin
Tourmaline | Level 20

Thank you all for the responses. I tried my best search online to find a parallel in the objective of some code editor to at least get basic indents done and absolutely no luck 😞  😞  😞  Very disappointed!!!

 

How about this idea, i.e when we post the code here using the running man icon, we get to have a pop up or prompt asking

choose

1. format code

2. No format code

 

and then we get to choose and post it as we like.  Any thoughts?

 

 

 

 

 

 

Tom
Super User Tom
Super User

SAS has enough trouble getting a syntax highlighter that comes close to understanding the complexity of SAS code.

So I am not sure how much I would trust a program to format SAS code properly.

 

Plus it would need a lot of options to format code to match users' personal style.

Most of the ones I have seen do nasty things like

  • use too large of indents (or worse use TAB characters for indents), 
  • hide continuation tokens (commas, logical operators, etc) at the end of the preceding line instead at the front of the continuation line
  • missing step indentation - indenting the closing keyword for a code block with the block's body instead aligning it with opening line.  It always makes it look like the block has not been terminated properly.
  • forcing the DO of a DO/END block added to an IF/THEN condition onto a new line.
  • not placing the closing semi-colon of a multiple line statement on a new line so that it is clear where the multiple line statement ends.

 

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 5 replies
  • 3030 views
  • 4 likes
  • 5 in conversation