Hi, I have a requirement to produce a series of multi-way contingency tables (2-3-4 maybe even 5 way if it is interpretable) to introduce a possible logistic model with many more than 5 variables. Since this will eventually take the form of a document to our clients, it will likely be done through ods pdf, rtf or html so I am somewhat flexible to that extent although I would like it to be as automated as possible so that any change in the data would require only to rerun the program and maybe to very minimal manual work beyond this. I'm basically looking at the following: data have; input var1 $1. var2 $1. outcome $1.; datalines; 0,0,0 0,0,1 0,1,0 0,1,1 1,0,0 1,0,1 1,1,0 1,1,1 ; run; /* Where each record would repeat a different frequency number of times and could possibly have more than just 2 classes but that is irrelevant to explaining what I wish to achieve */ ods pdf file="c:\temp.pdf"; proc freq data=have; table var1*var2*outcome / LIST; run; ods pdf close; The output generated is of a form similar to the table below. var1 var2 outcome=0 outcome=1 var1=0 var2=0 1 1 var1=0 var2=1 1 1 var1=1 var2=0 1 1 var1=1 var2=1 1 1 However, in litterature and which is also what I want to achieve, the outer variables (left most columns) values are normally only repeated when they change and not for every possible row. So my desired output would be something similar to var1 var2 outcome=0 outcome=1 var1=0 var2=0 1 1 var2=1 1 1 var1=1 var2=0 1 1 var2=1 1 1 I am looking for a way to achieve something similar in SAS. I'm absolutely not familiar with proc template and don't know if any other procedure (proc surveyfreq or proc tabulate maybe?) could achieve my desired output without playing with proc template. Nontheless, I am looking for the community help at the bare minimum to know if it is worth investing the time to learn proc tabulate for crosstabs (aka is it possible to achieve this output via proc template on crosstabs?). I believe I could achieve the desired output with heavy dataset manipulations and a proc print but it would be atrocious to double transpose the output from proc freq and blank out fields and whatnot for a job that may very well produce about a dozen 2-way tables, 66 3-way tables and (4 in 12) 4-way tables etc. Is it possible to do the above manipulation to the basic crosstabs output with proc template? Are there alternative procedures that could achieve the desired output? Are there additionnal options or suboptions on the table / LIST statement that could result in the same formating? Anything else that does not involve parsing the tables and using DDE to blank the appropriate fields? Thanks Vince
... View more