|
|
Re: SAS程序员测试(一)
[quote="xic":c835f]Here is a small test for your SAS programming skills, which was posted by some one in SAS User Group several years ago. I did it in my way, but I would like to share it with you all.
There is a Credit Card charging record data set, each line is either a charge or a return. Charge is a positive number, and return is negative. Assume that each item will be charged once, so if there is a return, it will be a full refund. A sample data set looks like the following:
Card_Number Charge <!-- s:twisted: --><img src="{SMILIES_PATH}/icon_twisted.gif" alt=":twisted:" title="Twisted Evil" /><!-- s:twisted: -->
A123 14.56
A123 15.23
A123 -14.56
A234 11.12
A234 3.87
A234 11.12
A234 -11.12
A234 4.86
Since the charge/return pair does not generate revenue, it should be deleted. So, the cleaned data set should look like the following:
Card_Number Charge
A123 15.23
A234 11.12
A234 3.87
A234 4.86
Please write a SAS program to accomplish this task.
You can give yourself a grade based on the following criteria:
60 - your program will solve this example correctly;
70 - your program will not only solve this example correctly, but also works for extended records following the same logic;
80 - besides meeting the criteria for 70, your program has a clear logical structure and other programmer is able to understand it without raising questions.
90 - clear cut, simple structure, efficient
100 - you can think about it.
If you have interests to do it and have questions about it, spell out. Good Luck.[/quote:c835f] |
|