feat(mf_getvalue)!: Breaking Change - Improve mf_getvalue()#418
Merged
feat(mf_getvalue)!: Breaking Change - Improve mf_getvalue()#418
Conversation
Member
|
Nice! I don't agree that it's a breaking change - rather, you have caught a previously undetected bug, and now those errors will be rightfully caught, as ought to be expected. |
allanbowe
approved these changes
Mar 19, 2026
|
🎉 This PR is included in version 4.62.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issues
1) Silent misbehaviour.
a) The test for the number of input observations is intended to ensure a selectable row exists but it is performed prior to applying the optional filter which can effectively reduce those rows to zero.
If insufficient observations exist to honour the
fetch()call then no feedback or warning is given. The following:returns an empty value to store in
&myvaland appears otherwise successful. The empty value could be deemed acceptable if the request was to return a character value. A false positive.The result of the 'zero obs' example applies also in the case where a
filter=argument is supplied that excludes all rows.In both cases, &SYSCC remains unchanged and the macro fails in an undetectable manner.
b) If a non-existent input data set is named then, although
%mf_attrn()logs an ERROR message, processing continues as normal andSYSCCremains unchanged (i.e. still0assuming it was0before the macro call). This prevents programmatically responding to issues.2) Restricted to reading the first row of data/filtered data.
This behaviour prevents trivial targeted row access. e.g. from calling
%mf_getvalue()from within a loop to access successive rows.Intent
Change macro to either succeed or report issues and set SYSCC.
Because accurately testing the number of observations on a filtered input dataset with
attrn()/NLOBSFcan be expensive, andNLOBSreturns the unfiltered number, the complexity can be reduced by trying only to fulfill the user's request and then test the return code.The job exit state and log will indicate issues.
Users may add conditional code to test
&SYSCCafter the macro call for fine-grained program flow if necessary.Permit the user to specify the required observation number, making targeted access possible. e.g.:
Implementation
mf_getattrn()observation number check.open()issues. (Previously caught bymf_getattrn())fetchobs=macro parameter specifies the desired row of the (optionally filtered) input dataset. Default is 1.fetch()tofetchobs()to isolate the requested observation.fetchobs()outcomes.Breaking Change
&SYSCCnow reflecting WARNINGs and ERRORs occuring during macro execution, previously uncaught issues will result in new behaviour, with SAS potentially returning a non-zero exit code.Checks
sasjs lint).sasjs test).