© ocs consulting 1 sas macro version control jim groeneveld, ocs consulting, rosmalen, the...

11
© OCS Consulting 1 SAS Macro Version Control Jim Groeneveld, OCS Consulting, Rosmalen, the Netherlands. 066-2007 – SGF 2007

Upload: gavin-burns

Post on 15-Dec-2015

218 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: © OCS Consulting 1 SAS Macro Version Control Jim Groeneveld, OCS Consulting, Rosmalen, the Netherlands. 066-2007 – SGF 2007

© OCS Consulting1

SAS Macro Version Control

Jim Groeneveld, OCS Consulting,

Rosmalen, the Netherlands.

066-2007 – SGF 2007

Page 2: © OCS Consulting 1 SAS Macro Version Control Jim Groeneveld, OCS Consulting, Rosmalen, the Netherlands. 066-2007 – SGF 2007

© OCS Consulting2

SAS Macro Version Control

CONTENTS

• Numbering, fixes, adds, new bugs• Backwards (in)compatibility• Version control: stopping version• Running version: backward supp.• Backward call, version distribution• Main version distribution macro• Distributing macro advantages

Page 3: © OCS Consulting 1 SAS Macro Version Control Jim Groeneveld, OCS Consulting, Rosmalen, the Netherlands. 066-2007 – SGF 2007

© OCS Consulting3

SAS Macro Version Control

Numbering, fixes, adds, new bugs

• Major.Minor.Patch[.Build] number;

• develop from 0.0.0; 1st release 1.0.0;

• newer versions may fix bugs and add features, are backwards compatible;

• newer versions may have new bugs or may not be backwards compatible;

• archive programs with versions used, prevent running them with newer vs..

Page 4: © OCS Consulting 1 SAS Macro Version Control Jim Groeneveld, OCS Consulting, Rosmalen, the Netherlands. 066-2007 – SGF 2007

© OCS Consulting4

SAS Macro Version Control

Backwards (in)compatibility

Backwards incompatibility:

• changed or removed arguments;

• changed parameter defaults;

• changed or removed parameter values with specific meanings;

• changed parameter functionality.

Best to avoid backwards incompatibility.

Page 5: © OCS Consulting 1 SAS Macro Version Control Jim Groeneveld, OCS Consulting, Rosmalen, the Netherlands. 066-2007 – SGF 2007

© OCS Consulting5

SAS Macro Version Control

Version control: stopping version

Version argument with vs number:, Version = 2.7.3k /* current vs */

Process user specified version value:

%IF (&Version NE &CurVs) %THEN %DO; %PUT *** &MacName *** &ERR: Specified vs. &Version does not match &CurVs;%GOTO Finish; %* Do not run this vs.;

%END; %* User fetches older macro;

Page 6: © OCS Consulting 1 SAS Macro Version Control Jim Groeneveld, OCS Consulting, Rosmalen, the Netherlands. 066-2007 – SGF 2007

© OCS Consulting6

SAS Macro Version Control

Running version: backward support

Alternative actions with backward incompatibilities:

• reproduce behaviour of older macro;

• support outdated argument names;

• control system that automatically fetches and uses older/any version: backward call, version distribution!!!

Programs validated with older versions.

Page 7: © OCS Consulting 1 SAS Macro Version Control Jim Groeneveld, OCS Consulting, Rosmalen, the Netherlands. 066-2007 – SGF 2007

© OCS Consulting7

SAS Macro Version Control

Backward call, version distribution

Based on other version control system:• unique, numbered file and macro name

for each version, e.g. ‘macro201’;• directly called by numbered name.

Backward call, version distribution:• last version also has numbered name;• distributing macro has main name;• numbered versions support stopping.

Page 8: © OCS Consulting 1 SAS Macro Version Control Jim Groeneveld, OCS Consulting, Rosmalen, the Netherlands. 066-2007 – SGF 2007

© OCS Consulting8

SAS Macro Version Control

Main version distribution macro

• version argument (all versions);• main supports _all_ arguments of older

versions by way of PARMBUFF option;• version parameter value is determined• dependent on user specified version

the right macro version is called with user specified &SYSPBUFF parameters;

• no version specification: last version.%AnyMacro(Data=_LAST_, Version=1.0.1a);

Page 9: © OCS Consulting 1 SAS Macro Version Control Jim Groeneveld, OCS Consulting, Rosmalen, the Netherlands. 066-2007 – SGF 2007

© OCS Consulting9

SAS Macro Version Control

Distributing macro advantages

• no need for explicit support of arglist;• only user specified parameters passed;• main has knowledge about versions;• slight adaptation if new macro version;• a version nr may represent compatible

ones of which the newest is chosen;• default (no vs spec) always newest vs;• any version callable at any time.

Page 10: © OCS Consulting 1 SAS Macro Version Control Jim Groeneveld, OCS Consulting, Rosmalen, the Netherlands. 066-2007 – SGF 2007

© OCS Consulting10

Questions and Answers

QUESTIONS&

ANSWERS

[email protected]

[email protected]

Page 11: © OCS Consulting 1 SAS Macro Version Control Jim Groeneveld, OCS Consulting, Rosmalen, the Netherlands. 066-2007 – SGF 2007

© OCS Consulting11

Q&A : origin

Origin of presentation

• experience with writing and validating standard SAS macros;

• collection of encountered and invented ideas on recommendations;

• observed weaknesses in (macro) program code in practice;

• felt need to improve quality of code;• the need to keep older (validated)

macro versions available.