BookmarkSubscribeRSS Feed
robertrao
Quartz | Level 8

Could anyone help me resolve this issue Please

3 REPLIES 3
robertrao
Quartz | Level 8

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

Tom
Super User Tom
Super User

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;

Cynthia_sas
SAS Super FREQ

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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 746 views
  • 0 likes
  • 3 in conversation