BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
pmbrown
Quartz | Level 8

Are there any tools to test if a sas program conforms to "good programming practice" (defined by Phuse), or other autochecks that may be relevant?

 

Statisticians in the pharma industry have a traditional (arduous) approach to quality control. I wouldnt want to disrupt that. But can we learn something from the data scientists? Auto checks are inherent in their work flow, they even have a term for it - “Linting” means running a basic quality tool against your code. The tool will check your code syntax...  

 

Github has checks built in (as a pre-commit) and there are add ons you can purchase: https://github.com/marketplace/codefactor . But if i search lexjansen's site and other sources I don't see relevant tools being developed by statistical programmers. Maybe I'm not looking in the right places?

 

I would therefore like to develop such a tool but it's unlikely I could do it on my own. Is there any interest from others in the SAS community to develop something along these lines, as an open source project?

 

to give a very basic example, according to gpp this should not appear in your code:

data a;
set a;

it seems it should be easy to detect if this exists within a program, and many other deviations from gpp too.

 

(Let me know if my Q is better placed on a different board)

 

cheers

1 ACCEPTED SOLUTION

Accepted Solutions
AllanBowe
Barite | Level 11

Hi @pmbrown ,

 

We (4GL Apps) completely agree - you shouldn't be pushing SAS code to GIT without basic lint checks (and testing)!

 

Which is why we built an MIT open source linter for SAS:  https://github.com/sasjs/lint

 

As you point out, a linter is a fantastic tool to run as part of a git pre-commit hook, or during a CI/CID pipeline.

 

You can find it bundled already in the following SASjs tools:

 

Being MIT licensed, you can fork and include it within any tool you wish, no restrictions whatsoever.

 

We're looking for partners and sponsors and contributors to improve the tool.  Just contact me here (PM) or on the website:  https://sasapps.io/contact

 

The full list of rules can be found in this JSON file:  https://github.com/sasjs/lint#linting

 

And a video here:  https://communities.sas.com/t5/SAS-Hacker-s-Hub/Hacker-tip-5-Linting-SAS-Code/td-p/801098

 

Anyone is free to contribute rules - we wrote a contributors guide here:  https://github.com/sasjs/lint/blob/main/CONTRIBUTING.md

 

By the way - you can also fix a lot of issues (such as your example of avoiding basic REPLACEing of datasets) by simply running SAS in strict mode - see this macro (which runs at the start of ALL the apps my team produce):  https://core.sasjs.io/mp__init_8sas.html

/Allan
SAS Challenges - SASensei
MacroCore library for app developers
SAS networking events (BeLux, Germany, UK&I)

Data Workflows, Data Contracts, Data Lineage, Drag & drop excel EUCs to SAS 9 & Viya - Data Controller
DevOps and AppDev on SAS 9 / Viya / Base SAS - SASjs

View solution in original post

2 REPLIES 2
AllanBowe
Barite | Level 11

Hi @pmbrown ,

 

We (4GL Apps) completely agree - you shouldn't be pushing SAS code to GIT without basic lint checks (and testing)!

 

Which is why we built an MIT open source linter for SAS:  https://github.com/sasjs/lint

 

As you point out, a linter is a fantastic tool to run as part of a git pre-commit hook, or during a CI/CID pipeline.

 

You can find it bundled already in the following SASjs tools:

 

Being MIT licensed, you can fork and include it within any tool you wish, no restrictions whatsoever.

 

We're looking for partners and sponsors and contributors to improve the tool.  Just contact me here (PM) or on the website:  https://sasapps.io/contact

 

The full list of rules can be found in this JSON file:  https://github.com/sasjs/lint#linting

 

And a video here:  https://communities.sas.com/t5/SAS-Hacker-s-Hub/Hacker-tip-5-Linting-SAS-Code/td-p/801098

 

Anyone is free to contribute rules - we wrote a contributors guide here:  https://github.com/sasjs/lint/blob/main/CONTRIBUTING.md

 

By the way - you can also fix a lot of issues (such as your example of avoiding basic REPLACEing of datasets) by simply running SAS in strict mode - see this macro (which runs at the start of ALL the apps my team produce):  https://core.sasjs.io/mp__init_8sas.html

/Allan
SAS Challenges - SASensei
MacroCore library for app developers
SAS networking events (BeLux, Germany, UK&I)

Data Workflows, Data Contracts, Data Lineage, Drag & drop excel EUCs to SAS 9 & Viya - Data Controller
DevOps and AppDev on SAS 9 / Viya / Base SAS - SASjs
pmbrown
Quartz | Level 8

fantastic! thanks for all the info, i look forward to checking it out. We will incorporate what we can into our workflow .. maybe i can give an update when we have done that. cheers

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 2 replies
  • 984 views
  • 1 like
  • 2 in conversation