The SAS Output Delivery System and reporting techniques

Proc Report for the clinical trial report (Appendix 16.2.5 and 16.2.6) *the topic updated

Reply
Regular Contributor
Posts: 214

Proc Report for the clinical trial report (Appendix 16.2.5 and 16.2.6) *the topic updated

[ Edited ]

Hi all,

 

Could you please help: what is the ODS for the reports Should I use options of the Report function? 

Frequent Contributor
Posts: 103

Re: ODS for the clinical trial report (Appendix 16.2.5 and 16.2.6)

Posted in reply to DmytroYermak

Hello and welcome to the forum!

 

You will probably need PROC REPORT to produce summary tables such as this. I have found this book to be very helpful:

 

https://www.sas.com/storefront/aux/en/spreportindpth/69155_excerpt.pdf

 

ODS specifies the output destination. For example, ODS RTF will generate a file that can be opened in Microsoft Word.

 

Good luck!

 

Norman.

Norman.
SAS 9.4 (TS1M4) X64_7PRO WIN 6.1.7601 Service Pack 1 Workstation

Regular Contributor
Posts: 214

Re: ODS for the clinical trial report (Appendix 16.2.5 and 16.2.6)

[ Edited ]

Thank you for the prompt reply! I actually need to prepare the Tables (as Repors) from 2 files - please see attached. Do I understand correctly that I have to prepare 2 datasets with descriptive statistics initially and then to use procedure report for both of them? So the SAS program will consist of: 1)Mean/Freq procedure steps for every statistic and receiving separate datasets for every variable; 2)Merging the datasets; 3) Transpose of the dataset; 4) Proc Report ?

Is it possible to unite steps 1) and 2)? I mean to use 'class' option for Mean, for example?

I have attached the learning datasets. Could you please have a look?

 

Frequent Contributor
Posts: 103

Re: ODS for the clinical trial report (Appendix 16.2.5 and 16.2.6)

Posted in reply to DmytroYermak

When I do this, I prepare a SAS file where each row corresponds to the row that you want to see in the final output. This file of pre-processed data is read into PROC REPORT.

 

To make the file, you might need to use the output from PROC MEAN or PROC FREQ, then "assemble" the text in a DATA step.

Norman.
SAS 9.4 (TS1M4) X64_7PRO WIN 6.1.7601 Service Pack 1 Workstation

SAS Super FREQ
Posts: 9,368

Re: ODS for the clinical trial report (Appendix 16.2.5 and 16.2.6)

Hi:

  My older paper, from 2008 http://www2.sas.com/proceedings/forum2008/173-2008.pdf has 3 examples of creating this type of report -- basically your plan is correct -- you do the summarizing and getting the percentages, etc and then you use a REPORT procedure. In my paper, I show using some "helper" variables to guarantee row order and the ability to apply bold/underline at certain places and to do the indenting.

 

cynthia

Regular Contributor
Posts: 214

Re: ODS for the clinical trial report (Appendix 16.2.5 and 16.2.6)

[ Edited ]
Posted in reply to Cynthia_sas

Thank you, Cynthia! Reading it as well as the programs: http://support.sas.com/rnd/papers/sgf2008/complex_reports.zip. If you do not mind I put my code here later on.

 

And I have another question: what is the way to output the result in .txt file?

 

Here below are my drafts:

 

Clin.Trial  Report 1.

/*Calculation of descriptive statistics of Age*/

PROC MEANS data=status n mean std median min max maxdec=2;
	var Age;
	/*output out=AgeStat;*/
RUN;

/*Calculation of descriptive statistics of Age Group*/

PROC FORMAT;
	value AgeGroupFormat
		17<-35='>17-<=35'
		35<-50='>35-<=50'
		50<-65='>50-<=65'
		65-high='>65';
RUN;

PROC FREQ data=status;
	tables Age / nocum;
	format Age AgeGroupFormat.;
	/*output out=AgeGroup;???*/
RUN;

PROC FREQ data=status;
	table Sex / nocum;
RUN;

PROC FREQ data=status;
	table Childpot / nocum;
RUN;

/*Calculation of descriptive statistics of Childbearing Potential*/

PROC FREQ data=status;
	tables Ethnic / nocum;
RUN;

/*Calculation of descriptive statistics of Height*/

PROC MEANS data=status n mean std median min max maxdec=2;
	var Height;
	output out=HeightStat;
RUN;

/*Calculation of descriptive statistics of Weight*/

PROC MEANS data=status n mean std median min max maxdec=2;
	var Weight;
	output out=HeightStat;
RUN;

/*Calculation of descriptive statistics of Duration of MS*/

PROC MEANS data=status n mean std median min max maxdec=2;
	var Durms;
	output out=DurationStat;
RUN;

/*Calculation of descriptive statistics of Duration of MS in Groups*/

PROC FORMAT;
	value DurationFormat
		low-1='<1'
		>1-5='>=1-<=5'
		>5-10='5>-<=10'
		>10-15='10>-<=15'
		15-high='>15';
RUN;

PROC FREQ data=status;
	tables Durmscat / nocum;
	/*format Durmscat DurationFormat.;*/
	/*output out=DurationFormat???*/
RUN;

/*Calculation of descriptive statistics of EDSS*/

PROC MEANS data=status n mean std median min max maxdec=3;
	var edss;
	/*output out=AgeStat;*/
RUN;

/*Calculation of descriptive statistics of EDSS Groups*/

PROC FORMAT;
	value EDSSformat
		0     = '0'
		1-2.5 = '1-2.5'
		3-4.5 = '3-4.5'
		5-6.5 = '5-6.5'
		7-8.5 = '7-8.5'
		9-9.5 = '9-9.5'
		10    = '10';
RUN;
 
 /*if null then assign 0* - should I work through if/else?*/ 
PROC FREQ data=status;
	tables edsscat / nocum;
	format edsscat EDSSformat.;
	/*output out=DurationFormat???*/
RUN;






 

 

And the Clin.Trial Report 2:

PROC SQL;
   	create table status_temp as
  	select site,pt,safety
   	from status
   	where safety=2;   
 
DATA ConMed (keep=site pt verbatim prefterm atcterm presbase studstrt durstud cont);
	merge cmed_dvd status_temp;
	by site pt;
		  	 	
RUN;

PROC FORMAT;
	value YesNoFormat
		1='YES'
		2='NO';
RUN;


PROC PRINT data=ConMed noobs;
	   
	format presbase studstrt durstud cont YesNoFormat.;
RUN;

 

It is a little bit far from the desired solution but please comment on any step of my strains. Does any information can be missed after sql and data steps in the second programm? Does it contain fatal errors? 

 

 

 

 

 

 

 

SAS Super FREQ
Posts: 9,368

Re: ODS for the clinical trial report (Appendix 16.2.5 and 16.2.6)

[ Edited ]
Posted in reply to DmytroYermak

Hi:
Since I typically do not open Excel files to get data, I cannot run your program and tell you whether the program has fatal errors. However, one easy way to find out is for you to run and test your program on your data. When you run your second program, does it have errors?

As far as I can see, you are not using any of the techniques from my paper in your program, so I am not sure what you are asking when you ask if the output can be sent to a TXT file. The regular SAS listing destination is the way to make an ASCII text file. However, the file will not have any style, fonts, colors, bolding, underlining, etc. The TXT file is very plain and none of my techniques would work for LISTING output.

However, there are 2 ways to direct your output to the SAS LISTING destination:
1) PROC PRINTTO
2) ODS LISTING file=

Both of those methods can be found in the documentation.

cynthia

Regular Contributor
Posts: 214

Re: ODS for the clinical trial report (Appendix 16.2.5 and 16.2.6)

[ Edited ]
Posted in reply to Cynthia_sas

I have attached the sas7bdat files: patients and concmed. Do I understand correctly that the files need no more transformations (besided some FORMATs) for the PROC REPORT?

 

Here it is my new code for 'patients'.

SAS Super FREQ
Posts: 9,368

Re: ODS for the clinical trial report (Appendix 16.2.5 and 16.2.6)

Posted in reply to DmytroYermak

Hi:
  In my paper, I do NOT calculate MEANS and FREQ inside PROC REPORT. Instead, as I showed in my first example, I take the patient information file and calculate the necessary statistics using PROC FREQ and PROC MEANS and then it is the dataset from those 2 procedures that goes into the PROC REPORT step (after making some helper variables to guarantee the order).

  However, as I indicated in my other posting, if you are interested in LISTING output (a TXT file), then the PROC FREQ, PROC MEANS part of my paper would be the same, but the PROC REPORT step might have to change a bit, since underlining, indenting and making some text bold will not work in the LISTING window.

  If you have my zip file from the 2008 paper, you can compare the first patient dataset that I have in the zip file with the final file created by my program that is sent forward to PROC REPORT.

  I did look at your two datasets and the answer is that neither one of them is ready to create your report using PROC REPORT. For example, you do not have any of the counts or percents calculated yet. The PROC REPORT step really will be easier to do if you use PROC FREQ and PROC MEANS to calculate your summary statistics.

  My zip file had 2 different versions of a program to calculate the statistics you want to report on. There was one program with each variable calculated separately and a second program that "macro-ized" the whole process. I suggest you look at the first program before tackling the macro program.

  You cannot use the program from my paper on your data in the current structure of the data. My paper showed how to run PROC FREQ and PROC MEANS to get the statistics into an output dataset, then showed how to manipulate that data a bit more to make 1 dataset of all the summary data, along with some helper variables to use in PROC REPORT. I suggest that you review my program step by step to see what each step was doing. The program I think will be the most help to you is the one named complex1_demog.sas. You will need to submit the complex0 program after you unzip the zip file to your local drive so you get the LIBNAME and setup steps finished before running the complex1_demog.sas program. This program has the PROC FREQ and PROC MEANS examples you ask for.


Cynthia

Regular Contributor
Posts: 214

Re: ODS for the clinical trial report (Appendix 16.2.5 and 16.2.6)

[ Edited ]
Posted in reply to Cynthia_sas
 
SAS Super FREQ
Posts: 9,368

Re: ODS for the clinical trial report (Appendix 16.2.5 and 16.2.6)

Posted in reply to DmytroYermak

Hi:

  Here are some observations about your posting. Your questions were:

 

1. The table should be output in 'clear' .txt format. When I use simple ODS Listing 'File.txt' I loss measures of the columns and lines.

ODS LISTING is not the same look and feel as ODS PDF or ODS RTF. So while I am not sure what you mean by the loss of measures of columns and lines, I suspect that you are finding that commands like #{thispage} and #{lastpage}, #{nbspace} and '#S={font_weight=bold} Age (years)' are ignored by ODS LISTING. Totally. Ignored. Not used. At all.

 

This is because the inline formatting commands that you use with ODS ESCAPECHAR of # are completely ignored by ODS LISTING. Those commands will ONLY work with PDF, RTF and HTML destinations -- destinations that support style (colors, fonts, bolding, etc). ODS LISTING is a plain ASCII text file, there are no colors, there are no fonts, there is no bold style in ODS LISTING outptut. So what you are trying might work for ODS PDF or ODF RTF but will NOT work for ODS LISTING.

 

2. I lost some observations that have 0% - some Ethics Origins, Durations of MS (years): N (%), EDSS Score: N (%). You can see when run Format file: progfmt.fmt - attached.

I don't understand "losing observations" if you mean that for example, the data only some missing categories -- for example. let's say that in some studies, you can have the possibility of 3 groups: Group1, Group2 and Group3. But in one dataset, you have all 3 groups and in another dataset you only have Group1 and Group3. If you need to see Group2 on the report with 0%, then that is something you can do using PRELOADFMT to get the 0% in your output dataset -- sometimes people will generate their summary data using the option so the 0% is automatically included sometimes people will "seed" the summarized data with the extra rows that they know are misting. I'm not sure what is needed in your case.

 

  

3. I was not able to put titles in Listing, not pdf. What are the common rules to implement it? Should I simply measure my page and place the title exactly where I calculate it?

I am not sure what you mean by "measure your page". If you consider my output (which is a revision of my demog1 program from my 2008 paper), I do see that titles are appearing in the TXT and the RTF output.

 

4. All dots of decimal shuld be alined in one line? How could it be realized?

My decimals are aligned in both outputs.

 

5. How to orient the pages in Landscape orientation, not portrait?

options orientation=landscape; Also, for listing, you may need to change LS and PS options.

 

Here is the output from my 2008 paper, redone using Courier New as the font and side by side with the ODS LISTING version of the same output. As you see, ODS style controls and ESCAPECHAR controls are ignored by ODS LISTING.

 

cynthia

compare_rtf_listing.png

 

(code is in attached program file, with a DATALINES section that makes data)

 

 

Attachment
Regular Contributor
Posts: 214

Re: ODS for the clinical trial report (Appendix 16.2.5 and 16.2.6)

[ Edited ]
Posted in reply to Cynthia_sas

Today I was working with the second table. Here it is the code. And I have added the original dataset.

 

SAS Super FREQ
Posts: 9,368

Re: ODS for the clinical trial report (Appendix 16.2.5 and 16.2.6)

Posted in reply to DmytroYermak
Hi:
I don't see any report code except for PROC PRINTS which you seem to be sending to ODS LISTING and also to ODS PDF. I expect that you will find the ODS PDF output and the ODS LISTING output look different. I am not sure why you do not have a FILE= option for the ODS PDF step.

You only posted your code and the zip file. Is there a problem or error in your code?

cynthia
Regular Contributor
Posts: 214

Re: ODS for the clinical trial report (Appendix 16.2.5 and 16.2.6)

[ Edited ]
Posted in reply to Cynthia_sas

I have removed 'ods pdf' as it was put by mistake. I faced two issues in Table 2:

 1. Headers are not placed 'right' and 'left'. Ones were placed correctly in pdf format, but in listing it was failed. What could be a reason?

 2. I am printing two datasets in one text file. The first part(from the first dataset) has to be headed as 'TREATMENT SEQUENCE = KEMSTRO/BACLOFEN', the second - as  'TREATMENT SEQUENCE = BACLOFEN/KEMSTRO'. The second part should begin from a new page. I have not found a decision. Could you please suggest?

 

As for the first Table - I failed with PRELOADFMT option but still am tryring. Plus the same issue with the titles - ones could not be placed right and left.

SAS Super FREQ
Posts: 9,368

Re: ODS for the clinical trial report (Appendix 16.2.5 and 16.2.6)

[ Edited ]
Posted in reply to DmytroYermak

Hi:
About #1, as I illustrated in my previous post just because code produces one result when used with PDF does not mean you will get the same results in the ASCII text file created by ODS LISTING. In fact, in my screen shot, I highlighted places in the TXT output that showed some crucial differences. Which headers are not placed RIGHT or LEFT? When you are using ODS LISTING and PROC PRINT if you are trying to use j=r and j=l in your TITLE or FOOTNOTE statement, those are style attributes that do NOT work for ODS LISTING.

So, if you had a title statement like this:
title j=l 'Left' j=c 'Center' j=r 'Right';
In ODS LISTING output, you would see this:
LeftCenterRight

That is because ODS LISTING does not use ANY style attributes in the TITLE statement. If that's what you mean by Headers, then the ODS LISTING output is working as it should work.

For your question #2, you say that the first part, from the first dataset has to be "headed" a certain way and then the second page has to be "headed" a certain way. When I run a test using ODS LISTING, I do see titles in my output. The code that created the image is shown underneath the image. I did not use your data because to illustrate page breaks and titles, I can use any dataset with PROC PRINT. Notice how, when I view the TXT file in Notepad, I do not really see separate "pages" except for the fact that I explicitly turned numbering on so I would see a SAS page number in the output. And over on the right side of the page 2 line, you see a little squiggly character that represents the "page feed", "line feed" or "carriage return" or "carriage control" character that indicates that when you print or open this file in a word processor, that a page break should go at this location.

 

When I open the same TXT file in Microsoft Word and go into Reading View, you can see that Word has correctly interpreted this squiggly character as being the start of a new page.

 

So I am not sure what to advise, because, again, ODS LISTING is working as it is supposed to work. For more in-depth help you might want to work with Tech Support and reference this track. In my previous posting (before this one) I showed how you could get bold and titles and indentings with ODS RTF and a fixed pitch font like Courier. You cannot force ODS LISTING to behave like PDF or RTF.

options nodate number orientation=portrait pageno=1;
  
ods listing file='c:\temp\titletest.txt';
  
title 'TREATMENT SEQUENCE = KEMSTRO/BACLOFEN';
proc print data=sashelp.class noobs;
run;
  
title 'TREATMENT SEQUENCE = BACLOFEN/KEMSTRO';
proc print data=sashelp.shoes noobs;
run;
ods listing close;



cynthia

 

compare_txt_file_title_notepad_vs_word.png

Ask a Question
Discussion stats
  • 22 replies
  • 2266 views
  • 5 likes
  • 3 in conversation