BookmarkSubscribeRSS Feed
GFW
Obsidian | Level 7 GFW
Obsidian | Level 7

I have searched the community, and find no related post.

 

So far, I can not find a complete style guide for SAS.

 

Hope someone can provide such information, or any good coding standard.

 

Thanks!

 

 

7 REPLIES 7
tomrvincent
Rhodochrosite | Level 12
google 'SAS style guide' and you'll find plenty.
Reeza
Super User

Pick one. 

https://lexjansen.com/search/searchresults.php?q=style%20guide

 

Keep an eye on dates on the papers, SAS is from the 1970's so there's a lot of old stuff laying around the internet.

 


@GFW wrote:

I have searched the community, and find no related post.

 

So far, I can not find a complete style guide for SAS.

 

Hope someone can provide such information, or any good coding standard.

 

Thanks!

 

 


 

Cynthia_sas
SAS Super FREQ

Hi:

  There's no Strunk and White or Chicago Style manual, if that's what you mean. There are a lot of papers on good coding practices. In Programming 1, we have some basic recommendations for program style:

1) start each statement on a new line

2) indent lines and use white space to aid readability.

3) use comments

 

As an example, which program would you rather work with?

proc print data=sashelp.class;title 'my title'; var sex age name height weight; run;

 
proc print data=sashelp.class;
title 'my title';
var sex age name height weight;
run;

 
** This is my first report;
proc print data=sashelp.class;
   title 'my title';
   var sex age name height weight;
run;

They are all the same program, I'd rather work with 3 or 2. Program 1 would make me crazy. But SAS doesn't care about readability, so it doesn't care.

 

Cynthia

GFW
Obsidian | Level 7 GFW
Obsidian | Level 7
Hi Cynthia,

Thanks for your suggestion, I prefer the third one and have been working with this style .
whs278
Quartz | Level 8
Agree that 1 is terrible. Prefer 3 to 2. Like to indent code within each data/proc step.

I wish there was a more consistent SAS programming style . I see so many variations. Some languages like Python, and to a lesser extent R, have very strict style guidelines.
tomrvincent
Rhodochrosite | Level 12
Out of curiosity, what 'community' did you search?
GFW
Obsidian | Level 7 GFW
Obsidian | Level 7
I mean this forum 🙂

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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