02-16-2016 06:57 PM
I'm hoping to get responses from many SAS users, with all different levels of experience.
Often, a SAS question can be answered many different ways. When you answer a question, how are you thinking about the best answer? Is it the shortest, fastest, most elegant answer? Would you always think that way, even if it meant giving a hashing solution or a macros-based solution to a novice user?
When you receive an answer, would you prefer the best answer (even if that means it might be two years until you actually understood the pieces of it)? Or would you prefer an answer that is perhaps less elegant, but uses tools that you are likely to be applying yourself sooner rather than later?
As I mentioned, I would like to see opinions from all levels of programmers.
02-16-2016 07:19 PM
Roughly 80% of my work revolves around ad hoc projects. Requests for similar work comes back sometimes after one or two years. So I tend to prefer easy to document and understand program code. If I have to spend a week getting re-familiar with the previous solution before I can update/modify or whatever may be called for that may not be practical.
Luckily most of my datasets are not very large, seldom over 400K records, so spending time for optimized run-time or storage limits is seldom a factor.
02-16-2016 07:58 PM
Personally, I like all kinds of answers. One of the great things about forums such as this is the variety of answers that come up. So for a table look up question, you might see a merge solution, a SQL join solution, a format solution, a hash solution, a macro solution, etc etc. When I ask a question, I'm happy to get any answer at all.
I will admit that even though I consider myself an experienced SAS programmer, it took me many years before I dove into hashing. But every time I saw an elegant hash solution posted somewhere, it was a good reminder to me to keep hashing near the top of my "to-learn list." And I probably went through the same delayed learning curve for PROC SQL, and GTL, and there are plenty of learning curves still ahead of me. Good answers always provide inspiration to go and learn more.
That said, when I answer questions, I do try to answer them at a skill level I think is appropriate to the questioner, particularly if I'm among the first to answer. So if someone writes "I'm new to macro...." I would typically answer differently than I would to someone who I suspect is an experienced macro programmer. My goal in answering a question is to help the asker understand a problem and learn an approach to solving it, not simply to provide working code.
02-16-2016 11:08 PM
I like answers that are right, general, elegant and multiple. It is always interesting to see diverse approaches to solving a problem. I prefer answers from those eloquent people who go to the trouble of explaining how and why a technique works. I often wish I had their talent and patience.
When answering questions, I make an effort to follow good programming style, e.g. use meaningful names and consistent code indentation. I try to promote the use of higher level programming tools such as regular expressions, time interval functions, and SQL. I also try to provide alternatives to macro programming whenever I can.
02-17-2016 02:32 AM
As someone who came to SAS from a programming background, I like to adhere to these principles
- Simple trumps clever
- If in doubt, use brute force
If, in order to improve performance, I have to violate one or both of these principles, on-the-spot documentation (in a comment) of what is being done and why is mandatory. I won't know why I did something when I have to maintain the code a year later.
02-17-2016 05:09 AM
For my 2p's worth. I agree with all the thoughts provided in the post so far. The variety of answers and the different ways of responding to a problem are very good. I also believe strongly in the keep it simple approach. Historically there have been many reasons for programming approches, however I do feel in the modern era, with all the advancements over the years, easy to read simple code, welll documented and tested is far better than complicated programming saving a few cycles (except maybe in big data circumstances).
One thing that is nice to see is the occasional post on the "why" of the matter. I think all of us could eventually get code working for any structure/problem, but in many instances the "problem" is actually in the thinking, process and structure behind the problem which would in itself resolve the problem.
02-17-2016 08:40 AM
Thanks to all who have answered so far.
However, if you are reading this ...
Please note that all the responders so far are advanced users of the software. I would also love to get some opinions from beginners as well. Anyone willing to venture a try at it?
02-17-2016 10:42 PM
A really good question and collaboration!
I think this is such a subjective topic which also depends also on the learning style of the person posting the question. People learn differently and as you've all found, people ask questions differently. I think there is some onus on the person asking the question as to how they would like a response too. Do they want a response with beginner style code, advanced style code, a visual, links to reference papers etc. ?
If a work colleague were to ask you a question in person, there is an understanding on the skill level and potentially a discussion on the response which allows you to also answer the question in more timely manner. In online forums the human factor is missing. The expression and tone is missing and there may be a misunderstanding and appreciation of cultural differences. I think if the person posting the question can elaborate a little more on their situation and requirements this will help the community provide a more tailored and human response.
P.S. This raises a good point @ChrisHemedinger - maybe on the "Post a Question" page, an additional question asking what kind of response they want could be added to the stop right there! checklist - which is a fabulous reminder feature!
02-19-2016 02:46 PM
I have noticed that when there is a range of solutions provided, the poster will generally select (designate as the 'Correct Answer') the answer that is the most sophisticated one that he/she understands. This is logical since the poster does not easily know if a solution that they do not understand is correct or not. We hope of course that the answers will help with the growth of their understanding as well as the understanding of others.