Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
PROC REPORT in Displaying Clinical Laboratory Results Ann Root, Pharmaceutical Research Associate, Inc.,Lenexa,KS END; Abstract RUN; Many features of PROC REPORT provide you with the simple tools for generating complex report listings for clinical laboratory results. This procedure is flexible enough to present results across columns or consolidate many observations into one record. -- format field for flagn -PROC FORMAT; VALUE This paper presents the steps for presenting lab data in a variety of ways utilizing PROC REPORT. FLAGN 2 = 'H' 3 = 'L'; RUN; 1. Lab Data Listings 2. Means and Standard Deviations of Labs 3. Changes of Means and Standard Deviation of Labs from Baseline -- sort data -- Background PROC SORT; BY NO CNT; RUN; PROC REPORT, new in release 6.06, allows for more flexibility than was available in previous SAS procedure. The PROC REPORT procedure makes reporting of data simpler and easier. The examples in this paper require less manipulation of lab data in a DATA step prior to reporting. -- Lab Data Listings proc report -- PROC REPORT DATA = LABDATA NOWINDOWS MISSING; The input data set for lab is generally stored in data sets with one observation representing one lab analyte result per subject. (see Output #1 for data) To display this data in the past, PROC TRANSPOSE was utilized to convert all the analytes of a subject's visit into one observation. COL NO VISIT SDATE ANALYTE,( '__' RESULT FLAGN); DEFINE NO / GROUP 'SUBJECT/NO' '__' ' ' WIDTH=7 FORMAT=Z3.; DEFINE VISIT/ GROUP 'VISIT' '__ ' ' ' WIDTH=16 ORDER=DATA; DEFINE SDATE / GROUP 'LAB/DATE' '__' ' '; DEFINE ANALYTE / ACROSS ' '; DEFINE RESULT / ANALYSIS WIDTH=10 ' ' FORMAT=BEST5.; DEFINE FLAGN / ANALYSIS WIDTH=1 ' ' FORMAT=FLAGN.; The following example produces a report that collapses all the observations sharing the same values for subject number, visit, and sample date into one observation. Each unique lab analyte is presented in the column header (see Output #2 for results) The first DATA step converts the variable field named flag to a numeric variable field named flagn. The DATA step procedure also categorizes the visits by a numeric sort field named cnt. BREAK AFTER NO / SKIP; TITLE 'LISTING OF LAB DATA - HEMATOLOGY'; -- Change flag to a numeric flagn field ---- Categorize visit to a numeric sort field --- RUN; DATA LABDATA; SET LABDATA; SELECT ( FLAG) ; WHEN ('HIGH') FLAGN=2; WHEN('LOW') FLAGN=3; OTHERWISE; END; SELECT (VISIT); WHEN('POST STUDY') CNT=3; WHEN('PRE STUDY') CNT=1; WHEN('24 HRS') CNT=2; OTHERWISE; The COLUMNS statement lists the variables appearing on the report in order from left to right. The DEFINE statement indicates the attributes of each of the variables appearing on the report. 1 The FORMAT = option is used to control how the value will be formatted on the report. The WIDTH = option determines the width of the columns. The ORDER = option specifies the order of the observations on the report. The default order with PROC REPORT is FORMATTED. One way to display a variable with more than one statistic is to use an alias. Since the statistics needed for result is n, mean and standard deviation an alias for result is used. A label can be identified in the DEFINE statement by placing a character string in single or double quotes. The use of '__' ' ' after the label on the define line produces an underline under the column headings with a blank line before the data is printed. The GROUP Usage Option will "group" the data (acts like a CLASS statement on PROC SUMMARY). It is used to aggregate data together that contains like values. The example consolidates multiple rows for the variables no, visit and sdate into one row. The result and flagn variables are defined using the analysis option. The ANALYSIS usage option is associated with numeric fields. If a variable is defined with the ANALYSIS usage option, the statistic used is assumed to be SUM unless another statistic that can be used with the ANALYSIS usage options(i.e. MEAN, MIN, STD) is specified. Since no statistics were associated with the analysis variables the statistic option being used is sum. For each row being consolidated using the group option there is only one value associated with the analyte variable , therefore mean, min, max or sum could have been specified for the statistic option. The ACROSS statement forms column variables from column headers. The analytes are displayed for column headers. An ACROSS variable can share a column with an analysis variable by using a comma between the two variables on the COLUMN statement. In the example two variables result and flagn in the COLUMN statement are associated with the analyte variable. The ACROSS usage option is being associated with the analyte variable, therefore the analysis variable it is associated with has to be numeric. This is the reason for changing the flag character variable to a numeric variable flagn . The BREAK statement produces a blank line after all the information for the grouping variable no is printed. The BREAK statement syntax is the keyword BREAK followed by the before or after argument, the / followed by the break options. (i.e. DOL,DUL,OL,PAGE,SKIP,SUMMARIZE,SUPRESS,UL) A number of SAS statements and options can be used to improve the appearance of the report, such as titles, footnotes, system options, and WHERE clauses. Within the labels specified on the DEFINE statement, one of six special characters can be specified that will extend the column heading over several columns(i.e. = _ . * - + ) . These special characters can be specified in the label on the DEFINE statement without any text between them, in which case they will underline only the column they are specified on. Note that if you wanted a solid line you could do this in the proc report option line by specifying HEADLINE. Means and Standard Deviations of Labs To print the means and the standard deviations of the analytes at each visit the GROUP variable is analyte. The ACROSS usage option is used with the visit variable. (see Output #3 results) 2 OUTPUT; END; RUN; ______________________________ PROC REPORT DATA = LABDATA NOWINDOWS MISSING; COL ANALYTE VISIT,(RESULT RESULT=TEMP RESULT=TEMPN); PROC REPORT DATA = CHANGE NOWINDOWS ; COL ANALYTE CHG CHG=TEMP CHG=TEMPN; DEFINE ANALYTE / GROUP 'ANALYTE' '__' LEFT; DEFINE VISIT / ACROSS ORDER=DATA 'VISIT' ' ' ; DEFINE RESULT / ANALYSIS MEAN 'MEAN' '__' FORMAT=8.2 ; DEFINE TEMP / ANALYSIS STD 'STD' '__' FORMAT=6.2 ; DEFINE TEMPN / ANALYSIS N 'N' '__' FORMAT=6.; DEFINE ANALYTE / GROUP 'ANALYTE' '__' LEFT; DEFINE CHG / ANALYSIS MEAN 'MEAN’ ' __ ' ' ' FORMAT=8.2; DEFINE TEMP / ANALYSIS STD 'STD' ' '__' FORMAT=6.2 ; DEFINE TEMPN / ANALYSIS N 'N' '__' FORMAT=6.; TITLE 'TABLE OF LAB DATA - MEANS AND STANDARD DEVIATIONS'; TITLE 'TABLE OF LAB DATA - CHANGE OF MEANS AND STANDARD DEVIATIONS FROM BASELINE '; RUN; RUN; In Summary Changes of Means and Standard Deviation of Labs from Baseline PROC REPORT is a very powerful procedure that combines many features of other procedures into one. The collapsing of records into one row using the grouping option is similar to PROC TABULATE or PROC SUMMARY. The analysis statement makes reporting of statistics easy and flexible allowing the presentation of a polished report. To report the statistics for the change of mean and standard deviation the labdata data set is modified to one record per subject, per analyte with the change from post -study to prestudy. (see Output #4 for data) Trademark Notice The GROUP variable is analyte. The alias statement being used in the COLUMN statement to create the mean, std, and n for the variable chg. (see Output #5 for results) SAS is a registered trademark of the SAS Institute Inc., Cary, NC, USA and other countries. Useful Publications SAS Institute Inc. (1993) SAS* Technical Report P-258, Using the REPORT Procedure in a Nonwindowing Environment, Release 6.07, Cary NC.;SAS Institute Inc. Acknowledgements I would like to offer thanks to my reviewers Michelle Bishop, Sue Campnest, Sandra Clark, and Catherine Sheley. PROC SORT DATA = LABDATA; BY ANALYTE NO; RUN; Author Ann Root Pharmaceutical Research Associates, Inc. Programmer Analyst II 16400 College Boulevard Lenexa,KS 66219 Phone 913 577 2706 Fax 913 599-2753 e-mail [email protected] DATA CHANGE; SET LABDATA; BY ANALYTE NO; RETAIN PRE POST; IF FIRST.NO THEN DO; PRE=RESULT; END; IF LAST.NO THEN DO; POST=RESULT; CHG=POST-PRE; VISIT= ' '; 3