Help using Base SAS procedures

Proc Report

Reply
Super Contributor
Posts: 1,041

Proc Report

Could anyone help me resolve this issue Please

Super Contributor
Posts: 1,041

Re: Proc Report

Posted in reply to robertrao

In the dataset I have sorted in the descending order of Discharges(number)... I wanted in that fashion
Type     Dept      Discharges
Normal    Health    400
Transfer  Health    60
Death     Health    10

I do a proc report and i keep getting like this:

Dept     Type    Discharges

Health   Death      10
             Normal     400
            Transfer   60

Super User
Super User
Posts: 7,042

Re: Proc Report

Posted in reply to robertrao

What code did you try?  If you already have sorted the data and do not want "order" style applied then just define every variable as a display variable.

proc reports data=HAVE nofs ;

column type dept discharges;

define type / display ;

define dept / display;

define discharges / display ;

run;

SAS Super FREQ
Posts: 8,864

Re: Proc Report

Posted in reply to robertrao

Hi:

  PROC REPORT uses either the default order in which the variables are stored in the dataset or the left-to-right order in which the columns are listed in a COLUMN statement. You did not list your code. If you want TYPE listed first on the report, it would have to be listed first on the COLUMN statement:

COLUMN TYPE DEPT DISCHARGES;

What do you have in your current COLUMN statement?

 

  However, do you only have 3 observations in your data file? Or, are there more observations? If you have more than 3 observations, you may need DEFINE statements to control whether an item is ORDER, GROUP or SUM.

   Also, since your data are already sorted in a particular order, then I would envision, that you would need a DEFINE statement for TYPE that was:

DEFINE TYPE / ORDER ORDER=DATA;

or

DEFINE TYPE / GROUP ORDER=DATA;

hard to tell which one without knowing more about your data and seeing the code you're using right now. And, if you think you'll want a "grand total" at the bottom of the report, you may also need an RBREAK statement:

RBREAK AFTER / SUMMARIZE;

cynthia

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