Help using Base SAS procedures

How to LOCK SAS syntax for editing

Reply
Frequent Contributor
Posts: 102

How to LOCK SAS syntax for editing

I was surprised to learn that SAS syntax files when opened for editing are not locked!  If I open a syntax file for editing and my colleague opens the same file, we can both be saving changes to the same physical *.sas file overwriting each other's work and without any warning of the fact that this is happening.

There is a LOCK command and statement for datasets but I can't find anything for SAS syntax.  Setting file properties to read-only outside of SAS helps but one needs to remove that restriction to save one's work and, once open, the file can be overwritten by anyone else.

Is there a way to lock a syntax file for editing for the duration that it is open in SAS or Enterprise Guide?

What solutions do people on this list practice to prevent simultaneous editing when not in a SAS Server environment?

Thanks,

Haris

Super User
Posts: 3,106

Re: How to LOCK SAS syntax for editing

You are correct. SAS uses the operating system's control of files when editing SAS programs. If the OS allows it, then that is the behaviour.

The best way to avoid this problem is to use a change management tool with your SAS programs, plus you get the added benefits of program versioning, team collaboration, automated code deployment etc. Examples of CM tools are GIT, Visual Studio/TFS. There are many others. 

Contributor
Posts: 23

Re: How to LOCK SAS syntax for editing

I have serious trouble regarding this question as well and we're considering trying out one of the solutions mentioned. Any recommendations - easy to use - CM tools? Any of them are free? Any links? Thanks Smiley Happy
Respected Advisor
Posts: 3,892

Re: How to LOCK SAS syntax for editing

CVS and SVN are the two version controls which have also OOTB integration into SAS DI Studio. GITHUB is likely the one going forward though and also used by SAS, for example here: https://github.com/sassoftware

 

...and I personally take an approach that version control is a good thing but also adds overhead AND it's no replacement for having clean and enforced development processes in place.  

Super User
Posts: 3,106

Re: How to LOCK SAS syntax for editing

I suggest you check out what CM tool(s) your company is already using. We use our company's standard tool (MVS/TFS) and it actually saves us a heap of time because all CM admin is taken care of.

 

Also using the tool is more efficient and quicker than not using it simply because storing and management of SAS program files is automated. 

Respected Advisor
Posts: 3,892

Re: How to LOCK SAS syntax for editing

@SASKiwi

I would be really interested to learn more in detail how and for what SAS objects you're using version control in your company, how this supports your processes, how much it takes to set this up and get up to speed, etc. etc.

 

I know that's asking for a lot from you. May be it's worth a paper for Global Forum?

 

I've been in multiple projects where version control was initially requested but it took always so much to get this properly set-up that the project was almost done before version control was really fully establishe.

Super User
Posts: 3,106

Re: How to LOCK SAS syntax for editing

@Patrick Thanks for the kind words. Doing a paper at Global Forum on this is probably a bit of a stretch. I've never actually been to one given it is about half a planet away from where I live. Would be nice to do though. I'll give it some thought as a Community Article for now.

 

I'm lucky to work at a company where a corporate-wide solution for version control / change management is freely available to everyone and I'm a complete convert. The prevailing attitude by many is that it is a necessary evil that adds way too much extra work. In my experience the opposite is true. It saves us time by not having to manually manage application artifacts. We never lose our code because even if we delete something it will still be there in an old version. I'm also frequently comparing versions to confirm what changes I've made. It has become an essential part of our testing processes.

 

Truly version control makes us more productive (not an oxymoron). For example I can double click on any SAS program stored under VC and it automatically opens in EG ready for editing or running. Another - someone else checks in a program change and when I retrieve it, EG (7.11) prompts me to ask if I want to load the change - how good is that?!  No more emailing each other bits of code etc etc....collaboration is just so much easier. 

Ask a Question
Discussion stats
  • 6 replies
  • 413 views
  • 1 like
  • 4 in conversation