06-23-2015 04:53 AM
I would like to know if there is a possibility to create an ERROR instead of a simple NOTE, when SAS comes across an unitialized variable (in a data step).
Thanks in advance.
06-23-2015 04:59 AM
I wouldn't think so as its not an error (just bad programming practice). SAS can hold empty variables so its just informing you that it was not used. Personally, I would say fix the coding, there's no reason why there would need to be these in the log in the first place, even if you do want a blank variable then: var=""; would suffice, then it is clear that it is meant.
You could post process a dataset to see what new variables are created (keep SASHELP.VCOLUMN, and then again after run, merge the two where not in both to get list of new variables) then check if any contain no data. But why, seems to be fixing a problem which shouldn't be there in the first place.
06-23-2015 05:15 AM
You are right: these notes shouldn't be in the log at all.
The problem is that my SAS process is getting more and more complicated. I sometimes had the problem that I had a typo in a variable name and SAS started calculating with missing values. Or I deleted a variable in a data set where this variable was later used but I wasn't aware of it in the first place. Additionally we are several colleagues working on different parts of the SAS process.
The reason why I (and also my colleagues) would like to have these notes of unitialized variables as an error or a warning is that we would notice it earlier and do not lose so much time by looking for the problem.
06-23-2015 05:25 AM
If its a complicated process with multiple team members, then you would be best of following Software Development Lifecycle processes. Define the problem, scope certain areas for certain people, break the problem down, document and detail each section etc. Then the coding should be next to nothing. The problem sounds like it arises when programmers (and we are all guilty) just charge ahead bashing out lines of code without a spec or plan.
If its really a problem, then in your detailed plan define something along the lines of Interfaces, i.e. this part of the code will have datasets a, b and c which contains these variables. You can then add code in at these interface sections which check the datasets for conformity. A bit like having data transfer documentation that detail structure (and possibly content).
Need further help from the community? Please ask a new question.