The SAS Output Delivery System and reporting techniques

ODS output data structures

Reply
Trusted Advisor
Posts: 1,151

ODS output data structures

Hi all,

Apologies if this qualifies as a rant, but I'd be interested in some opinions.  I feel like I have a love-hate relationship with the ODS OUTPUT statement, and curious how others feel.

On the one hand, I love the ability to get PROC output as data.  And I like it so much that I usually use it before looking to see if a PROC has a specific OUTPUT statement, our OUT option, or OUTEST, etc.

That said, when I see the structure of the output datasets, I'm often, well, disappointed.  For example:

ods output FitStatistics=Fit;
proc reg data=sashelp.class;
  model height=weight;
run;
ods output close;
proc print data=Fit;
run;

Outputs:

                                                                                 
 Model     Dependent    Label1            cValue1          nValue1     Label2     cValue2         nValue2 
MODEL1     Height      Root MSE           2.52736        2.527356    R-Square    0.7705        0.770507 
MODEL1     Height      Dependent Mean    62.33684       62.336842    Adj R-Sq    0.7570        0.757007 
MODEL1     Height      Coeff Var          4.05435        4.054353                                     0 

There are so many obvious things wrong with the structure of that dataset, I won't even start.

So my question: is it fair for me to be disappointed by the structure of so many ODS output datasets, or should I be thinking about this another way?  Could it be that this format is useful to the PROC developer (I don't see how), so I should expect that it wasn't designed for my needs?  I struggle to see how this format could be useful to just about anyone...  Of course for backwards compatibility, its unlikely to hope that these output objects will be re-designed (thought it certainly has happened in the past), but does it suggest that SAS should consider adding alternative output objects?  Or am I just asking too much of ODS OUTPUT, and should go back to the PROC-specific syntax for getting at such data?

Kind Regards,

--Quentin

Grand Advisor
Posts: 9,748

Re: ODS output data structures

I could say you haven't specified as to what you find objectionable.

I guess it has to do with different items (label1) values per row. I would suggest that there are many, many posts on this forum as well as other sources that involve transposing the data into other shapes. The advantage is once you know what you want to do you can reuse the program to do the same time and again.

And you should see the things I've had to do with output from other programs because the users couldn't be bothered to learn output options and had to copy/paste/delete thousands of lines in text files...

Trusted Advisor
Posts: 1,151

Re: ODS output data structures

Yes, my problems with above are

  • Two items per row
  • Last item which is null, except nValue2 is 0 rather than null.
  • Having both a numeric and character variable that store the same information.

It is not hard to get data out of this format, and it is not the worst format imaginable.  But, it's still surprising to me that at some point some SAS developer sat down to create this table, and thought this structure was a good idea, rather than say 4 columns: Model; Dependent; Label; Value.

If somebody posted a structure like that in a question here, I think the correct answer would be "fix your data structure to be more normalized," rather than "here is how to work with your data."

When I see structures like this, I'm wondering if it's because somebody didn't put much time into it, or if somebody really thought this was a good idea.  The ODS output from PROC COMPARE is even worse...  I guess I would hope for better data structures from SAS PROCS.  Particularly because all of these table structures are new as of V7 (or perhaps they were only newly exposed via ODS, and already existed?)

Post a Question
Discussion Stats
  • 2 replies
  • 328 views
  • 0 likes
  • 2 in conversation