I am having problems with a SAS report showing data in it when there is none. It is an old SAS report that has data from 2/12/2009.
Sometimes a query I run will have a data and sometime it will not have any data after the uses change information, the time it does not have any data in the query the SAS report remembers the old report and includes this in the main report. Is there a way to show not data in the SAS Report if the query has no data, and not show the last SAS report.
My guess is that SAS is not using the old data, but rather there is no output from the procedure and the report does not get replaced. There are two ways to check for this.
1) look at the time stamp in the footer. It shows when the table was created (the one in the header just shows today's date, so it is not of much use). [You may need to modify the titles tab to put the footnote back in.]
2) look at the task log. If it has errors, the ODS CLOSE statement is not run and the report is not replaced.
I'm not sure how to solve this, but here is a guess. Add some ODS code to the beginning of the task to open the output destination and then close it. Then open it again in the regular way. I've not tried it, but I suspect that it will create a null report (perhaps just titles) that is replaced with a successful report if the task completes.
ODS stands for "Output Delivery System". If you look in your SAS log, you should see an ODS "sandwich" around your code -- put there by EG -- and it should look something like this:
ODS HTML .......<more stuff>
< code generated by EG >
ODS HTML CLOSE;
If you have closed and opened EG since you first had the problem, you don't have to worry, the ODS statements would be closed by closing EG. If, for example, you inserted some code into the "sandwich" -- into the statements generated by EG and -IF- the inserted code had an error, such an error might cause the "ODS HTML CLOSE"; to be unrecognized -- and thus, the file that ODS should have created would NEVER be replaced.
The best solution is to take a very close look at the SAS Log that runs. All you have to do is click 'Open' on the Log icon. Even if you don't understand everything in the Log, look for lines that have the word 'ERROR' or the word 'WARNING'. Some warnings are OK (like ones about VALIDVARNAME), but be on the lookout for any warnings about quoted strings being too long.
There is nothing about ODS that is terribly important at this point. ODS is merely catching the results from SAS and putting them in an HTML, RTF or PDF file for you. The important thing is that ANY error in the program will prevent ODS from writing over the previous report (not just errors in the code you create). So, for example if a file does not exist when you run your project, previous results might not be replaced.
It would really be better for you to examine the SAS log or post a bit of the log here. Or ask one of the more experienced SAS programmers to take a look at the Log to help you figure out the problem. You can also contact Tech Support and they will look at your entire LOG and help figure out what might be going wrong.
SAS uses ODS to deliver the output to EGuide. EGuide builds some ODS statements into the code it sends to the SAS server. SAS has an entire book on ODS in the documentation at support.sas.com. It can get complex enough that there is also a SAS Discussion Forum devoted to it.
I'm no ODS expert (far from it), so I'd just try cut-n-paste on the code that EGuide generates to see if that will work reasonably before delving into the documentation too deeply.