BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
kuridisanjeev
Quartz | Level 8

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


Required Output.JPG
1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

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


patient_demog_output.png

View solution in original post

8 REPLIES 8
ballardw
Super User

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.


kuridisanjeev
Quartz | Level 8

Could you please provide code for that logic..

Reeza
Super User

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

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

Reeza
Super User

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.

Cynthia_sas
SAS Super FREQ

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

kuridisanjeev
Quartz | Level 8

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

Cynthia_sas
SAS Super FREQ

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


patient_demog_output.png
kuridisanjeev
Quartz | Level 8

Thanks a lot Cynthia for your help...

Sanjeev.K

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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