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
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
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.
Could you please provide code for that logic..
Here's a good one that's almost identical to what you need:
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.
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
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
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
Thanks a lot Cynthia for your help...
Sanjeev.K
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: