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.

 

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1744 views
  • 4 likes
  • 5 in conversation