Help using Base SAS procedures

In the below mock-up How to get serum summary of observed data and imputed data kewords using proc report.Please solve me.

Reply
N/A
Posts: 1

In the below mock-up How to get serum summary of observed data and imputed data kewords using proc report.Please solve me.

           low- normal-high       low-normal-high

            N(%) N(%) N(%)       N(%) N(%) N(%)

----------------------------------------------------------------

serum-summary of observed data

week1 XX(X) XX(X) XX(X)

serum-summary of imputed data

week2 xx(X) XX(X) XX(X)

Super User
Posts: 19,768

Re: In the below mock-up How to get serum summary of observed data and imputed data kewords using proc report.Please solve me.

You need to provide more information, what your data looks like for example.

Based on the very limited information provided, I'd say proc report isn't the place to start. Proc tabulate may be an option based on your data.

There's a good paper on how to accomplish this in SAS:

http://www2.sas.com/proceedings/forum2008/173-2008.pdf

I believe Example 8, the second part is close to what you want.

Super User
Posts: 10,018

Re: In the below mock-up How to get serum summary of observed data and imputed data kewords using proc report.Please solve me.

you can use

compute before week;

line ........;

endcomp;

You would better post it at ODS and Base Reporting

Cynthia would give you detail code.

Xia Keshan

SAS Super FREQ
Posts: 8,861

Re: In the below mock-up How to get serum summary of observed data and imputed data kewords using proc report.Please solve me.

Hi,

  As Reeza points out, the structure of the data is crucial to deciding which procedure to use. Although PROC TABULATE might work for most of the report, it cannot write out text before a group, such as you show.  Although TABULATE will not write out customized text, such as you show, PROC REPORT can do that, with a LINE statement in a COMPUTE block. Also, PROC TABULATE will not put two numbers together in 1 cell (such as your N and %) -- you have to make a character variable with the N and the % concatenated with the parentheses. You can either do that in a DATA step program or you can do that with PROC REPORT.

      

Since you did not post your data or explain what type of ODS destination output you wanted, the program below assumes that your data is already in a structure which can be easily used with PROC REPORT. As Xia points out, to write a customized break line, you will need to use a COMPUTE block. The paper link that Reeza gave you has several different examples of producing a demographic type report. Example 1 and 2 both use PROC REPORT. The code that goes with the paper is downloadable from Technical Papers and Presentations made by SAS staff -- scroll down to the section for 2008 to find the download link.

       

  Here's another example of less complicated code, just showing what you asked -- how to get the extra lines onto the report. Of course with different data, in a different structure, the PROC REPORT code might be entirely different, and/or you might need data manipulation to get the data ready for PROC REPORT.

Cynthia
       

data reportdata;

length week low1 normal1 high1 low2 normal2 high2 $6;

  infile datalines dsd dlm=',';

  input week $ low1 $ normal1 $ high1 $ low2 $ normal2 $ high2 $;

  label low1='Low/N(%)'

        normal1 = 'Normal/N(%)'

        High1 = 'High/N(%)'

        low2='Low/N(%)'

        normal2 = 'Normal/N(%)'

        High2 = 'High/N(%)';

return;

datalines;

week1, 11(1), 21(2), 31(3), 41(4), 51(5), 61(6)

week2, 24(1), 34(2), 44(3), 54(4), 64(5), 74(6)

;

run;

    

ods _all_ close;

ods html file='c:\temp\reportdata.html';

title 'Report Example';

proc report data=reportdata split='/' nowd style(column)={just=r};

  column week ('Group 1' low1 normal1 high1) ('Group 2' low2 normal2 high2);

  define week / order style(column)={just=l};

  define low1 / display;

  define normal1 / display;

  define high1 / display;

  define low2 / display;

  define normal2 / display;

  define high2 / display;

  compute before week / style={color=red just=l font_weight=bold};

     length brkline $50;

     if week = 'week1' then do;

        brkline = "serum-summary of observed data";

     end;

     else if week = 'week2' then do;

      brkline = "serum-summary of imputed data";

    end;

    lg = length(brkline);

    line brkline $varying. lg;

  endcomp;

  run;

  ods html close;

Ask a Question
Discussion stats
  • 3 replies
  • 195 views
  • 0 likes
  • 4 in conversation