12-18-2012 08:48 AM
I am using bellow Proc Tabulate code to produce one table with Admit dataset in SASUSER lib..
Proc tabulate data=t missing out=iytytyt;
class sex actlevel;
table Fee = 'Fee' *
(n = 'n' * f = 8.
mean = 'Mean' * f = 5.1
std = 'Standard Deviation' * f = 5.1
min = 'Min' * f = 3. Max = 'Max' * f = 3.)
Sex = 'Gender' *
(n='n' * f = 3. )
Actlevel = 'Actlevel' *
(n = 'n' * f = 3. colpctn = '%' * f = 4.1),
(actlevel = " ") (all = 'Overall');
Please provide Proc Report code to get above result..
Thanks & Regards..
12-18-2012 08:53 AM
Can you provide some data or replicate your table using one of the SASHELP datasets? It's very hard to code an example without knowing the structure of the input data. Also, what is your destination of interest? ODS HTML, RTF, PDF? Also, can you explain why there needs to be a switch to PROC REPORT if you have working TABULATE code? Is there some additional processing that needs to be done in REPORT -- that might change the type of REPORT code that gets generated. Oh, and, also the purpose for the OUT= (what is the ultimate use for the output dataset)?
Also, you are crossing a CLASS variable (ACTLEVEL) with itself, which should cause a WARNING message like this. Can you explain why you want to cross the variables this way?
WARNING: A class variable is crossed with itself in the table statement at line ??. This may cause unpredictable results.
12-18-2012 09:06 AM
Thank you for your quick reply..
I have attached ADMIT dataset. and i am not that much familiar with Proc Tabulate.So i want to switch That code into Proc Report.
And i want to create listing output with RTF format and don't need output dataset as well..
12-18-2012 09:20 AM
Sorry, I just looked at the TABLE statement. You crossed the ACTLEVEL variable with itself. That is not generally something that one does in a report. Not sure why you are doing that. What did you want to see on the last rows of the report?
Anyway, PROC REPORT will not derive statistics in the ROW dimension the way that TABULATE does. TABULATE will do crossing (*) in all 3 dimension, PAGE, ROW and COL. But REPORT will only support crossing in the column area, with a usage of ACROSS. Usually in a report like this, you would have pre-calculated the statistics - -probably with PROC MEANS or possibly with TABULATE or SQL. Generally, then you make columns something like this:
COLUMN GRPORD ROWORD VARNAME STATNAME .....;
where you would have to assign some ordering variables to assure that the summarized numbers and statistics stayed in the order you wanted. Take a look at my paper called "Creating Complex Reports" -- especially at example 1, page 9 -- all the statistics had to be pre-calculated. (http://www2.sas.com/proceedings/forum2008/173-2008.pdf)
Also, if this is truly ADMISSIONS data, then it is possible that someone at your company has already created a report like this. Generally, when you work with clinical trial data, the same programs are re-tooled for each new study.
12-18-2012 09:35 AM
Thank you very much for your suggestions Cynthia..
Actually I am working with Some clinical report and input data is bit similar to Admit Dataset..Thats why i used Admit Dataset to create Sample report.
Any way i need some logic in Proc Tabulate and i will post those requirements in my next post..
Onece again thank you so much...