The SAS Output Delivery System and reporting techniques

Need help in Proc Tabulate.

Accepted Solution Solved
Reply
Super Contributor
Posts: 276
Accepted Solution

Need help in Proc Tabulate.

Hi All...

I am running bellow Proc Tabulate code to create listing  Output.

Proc tabulate data=t missing ;

class   sex actlevel;

var fee;

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",actlevel;

run;

But I am not getting exact format,which client was asking.

I attached data and my requirement as well..Could you please help me on this..

Thanks & Regards..

Sanjeev.K

Attachment
Attachment

Accepted Solutions
Solution
‎12-19-2012 12:42 PM
SAS Super FREQ
Posts: 8,719

Re: Need help in Proc Tabulate.

Hi:

  You can go here: http://support.sas.com/rnd/papers/sgf2008/complex_reports.zip and get the zip file of programs and data that accompanied my paper. My example 1 program(s)  and my example 8 programs both work using the data file that I provide in the zip. I just demo'd them at a user group meeting in November. You should be able to compare my patient_info file with your file and then once you understand how my program works using MY data, you can adjust the program to work with YOUR data.

  If you look in the zip file, you can see that there are actually several programs:

complex1_demog.sas (uses patient_info data)

complex1_demog_data_macro.sas (uses patient_info data)

and complex1_demog_examp_alt_data.sas (this one uses different data than the first 2, also in the zip file)

In addition, the DATA _NULL_ example is complex8_demog_data_null.sas (uses patient_info data)

  I've already written this program 4 times in order to write the paper. Nobody knows your data as well as you do. The full code and the datasets are all in the zip file. My suggestion would be to start with the PROC REPORT example -- to me, it would be too confusing to try to switch between PROC REPORT and DATA step. You should be able to put my data in c:\complex directory and then make a c:\complex\output folder and issue the complex0_libname.sas program to establish the library reference. Then, the complex1_demog.sas program should run for you. My patient_info file is not too lengthy -- 1049 obs and 8 columns.

  The columns are:

Variable    Type  Len  Format     Label

patient_id  Num    8             Pat. ID

age         Num    8             Age

Gender      Char   6   

cadn        Num    8             CAD (Required)

cadmi       Num    8             Myocardial Infarction Category

hypern      Num    8             Hypertension Category

nyha        Char   3             NYHA Category

lvef        Num    8    COMMA8.  Left Ventricular Ejection Fraction

In order to adjust any sample program to your data, you first have to understand what the program is doing and how it works. Once you understand how my program is working, then you should be able to modify it to suit your needs. My program, run directly from the zip file, produces the output shown in the screen shot.

cynthia

View solution in original post

Attachment

All Replies
Grand Advisor
Posts: 10,210

Re: Need help in Proc Tabulate.

Tabulate isn't likely to be your answer as the calculations, as you have found out, want to be in separate cells.

You might try using Proc means/summary to generate the statistics for the class variables output to a dataset. The use a data step to create the strings you need like the Mean (std dev) pairs with a variable to hold a row label and then proc print to display.


Super Contributor
Posts: 276

Re: Need help in Proc Tabulate.

Could you please provide code for that logic..

Grand Advisor
Posts: 17,332

Re: Need help in Proc Tabulate.

Here's a good one that's almost identical to what you need:

http://www.lexjansen.com/pharmasug/2010/tt/tt05.pdf

Grand Advisor
Posts: 17,332

Re: Need help in Proc Tabulate.

Proc tabulate isn't the answer, this is a fairly customized report, though an almost standard 'clinical' or publication style reporting.

Google clinical reporting on lexjansen.com

for some solutions on how to get what you want.

SAS Super FREQ
Posts: 8,719

Re: Need help in Proc Tabulate.

Hi:

  What you show here is almost exactly what I showed in my paper "Creating Complex Reports" -- you are not going to get this kind of report from PROC TABULATE. Did you look at my paper? Most people either create this report with PROC REPORT or they use a DATA _NULL_ step if they are creating LISTING output.

cynthia

Super Contributor
Posts: 276

Re: Need help in Proc Tabulate.

Hi Cynthia..

I have gone through your paper and tried get desired output with Proc report and Data _null_,but i can't.

If you don't mind could you please provide code for above dataset to get required output,then i can apply same logic to my original dataset..

that would to be helpful for me..

Thanks in Advance...

Regards..

Sanjeev.K

Solution
‎12-19-2012 12:42 PM
SAS Super FREQ
Posts: 8,719

Re: Need help in Proc Tabulate.

Hi:

  You can go here: http://support.sas.com/rnd/papers/sgf2008/complex_reports.zip and get the zip file of programs and data that accompanied my paper. My example 1 program(s)  and my example 8 programs both work using the data file that I provide in the zip. I just demo'd them at a user group meeting in November. You should be able to compare my patient_info file with your file and then once you understand how my program works using MY data, you can adjust the program to work with YOUR data.

  If you look in the zip file, you can see that there are actually several programs:

complex1_demog.sas (uses patient_info data)

complex1_demog_data_macro.sas (uses patient_info data)

and complex1_demog_examp_alt_data.sas (this one uses different data than the first 2, also in the zip file)

In addition, the DATA _NULL_ example is complex8_demog_data_null.sas (uses patient_info data)

  I've already written this program 4 times in order to write the paper. Nobody knows your data as well as you do. The full code and the datasets are all in the zip file. My suggestion would be to start with the PROC REPORT example -- to me, it would be too confusing to try to switch between PROC REPORT and DATA step. You should be able to put my data in c:\complex directory and then make a c:\complex\output folder and issue the complex0_libname.sas program to establish the library reference. Then, the complex1_demog.sas program should run for you. My patient_info file is not too lengthy -- 1049 obs and 8 columns.

  The columns are:

Variable    Type  Len  Format     Label

patient_id  Num    8             Pat. ID

age         Num    8             Age

Gender      Char   6   

cadn        Num    8             CAD (Required)

cadmi       Num    8             Myocardial Infarction Category

hypern      Num    8             Hypertension Category

nyha        Char   3             NYHA Category

lvef        Num    8    COMMA8.  Left Ventricular Ejection Fraction

In order to adjust any sample program to your data, you first have to understand what the program is doing and how it works. Once you understand how my program is working, then you should be able to modify it to suit your needs. My program, run directly from the zip file, produces the output shown in the screen shot.

cynthia

Attachment
Super Contributor
Posts: 276

Re: Need help in Proc Tabulate.

Thanks a lot Cynthia for your help...

Sanjeev.K

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 8 replies
  • 462 views
  • 0 likes
  • 4 in conversation