Learning SAS? Welcome to the exclusive online community for all SAS learners.

Proc Report

Reply
New Contributor
Posts: 4

Proc Report

Hello,

I'm working on proc report and trying to get the variables one below the other in rows. What I'm getting is the output in columns. Does anyone have an idea how to get the variables ine below the other in rows and not columns in proc report? I'm familiar with the Order option in SAS but not sure how to use it.

Thanks

SAS Super FREQ
Posts: 8,864

Re: Proc Report

Hi, without data, or an example of what you mean by "get the variables one below the other in rows".

For example, using SASHELP.CLASS as an example, how would you want the output from this report to be different? With a specific example. You might post a prototype report as an example or post examples of code that you have tried.

cynthia

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

  proc report data=sashelp.class nowd;

    column name age sex height weight;

    define name / order;

    define age / display;

    define sex / display;

    define height / display;

    define weight / display;

run;

ods html close;

New Contributor
Posts: 4

Re: Proc Report

Posted in reply to Cynthia_sas

Hi Cynthia,

Thank you for replying to my query. I have included my sample data and the table that I want out of it from Proc Report. (for some reason the bold lines are not showing up on the right hand side of the sample table)

Data new;

input ID age agegrp $20. crcl crclgrp $20. thrombo $;

datalines;

1 83  >=75-<85years    81.9 >=80(Normal)        N

2 80  >=75-<85years 55.1 >=50-<80(Mild)    Y

3 74  >=65-<75years 19.5 <30(Severe)        N

4 86  >=85years        60.8 >=50-<80(Mild)    N

5 82  >=75-<85years 29.5 <30(Severe)        Y

6 85  >=85years     79.2 >=50-<80(Mild)    N

7 71  >=65-<75years 94.7 >=80(Normal)    N

8 81  >=75-<85years 48.1 >=30-50(Moderate) N

9 76  >=75-<85years 60.1 >=50-<80(Mild)     N

10 74  >=65-<75years 45.4 >=30-50(Moderate) N

;

proc print;

run;

Thromboembolic complications
and death

N

Y

Number of Patients [N(100%)]

151(76.26)

47(23.74)

Age [years] (age)

N

151

47

Mean

76.02

77.66

SD

9.80

9.22

Min

47.00

60.00

Max

96.00

94.00

Creatinine clearance (crcl)

N

151

47

Mean

63.64

48.46

SD

36.44

31.68

Min

8.17

7.94

Max

192.89

138.14

Age group (agegrp) [N(100%)]

< 65 years

49(32.45)

14(29)

>= 65 - < 75 years

57(37.75)

17(36.17)

>= 75 - < 85 years

30(19.87)

12(25.53)

>= 85 years

15(9.93)

6(6.65)

Renal function (based on creatinine clearance by Cockroft-Gault formula) (crclgrp) [N(100%)]

< 30 (Severe)

27(17.88)

17(25)

>= 30 - < 50 (Moderate)

24.50(18)

10(20)

>= 50 - < 80 (Mild)

23(16)

12(15)

>= 80 (Normal)

27.81(16)

8(23)

I tried using the below code. But the variables appear to be in columns. I want them to be displayed with all the statistics one below the other in rows like the table above.

proc report data=new;

column age agegrp crcl crclgrp, thrombo (n pctn);

define age/analysis N min max median;

define crcl/analysis N min max median;

define agegrp/group;

define agegrcrclgrpp/group;

define thrombo/across;

run;

Super User
Super User
Posts: 7,942

Re: Proc Report

I do find the forums annoying when posts appear sometime after you have responded to them.  It looks like your developing a Demography table, have a look at the examples given here: https://code.google.com/p/phuse-scripts/

Note, these are for example.

New Contributor
Posts: 4

Re: Proc Report

Well, I have to wait for the moderator to approve my posts even if I reply soon enough

Super User
Super User
Posts: 7,942

Re: Proc Report

Is it possible you are talking about normalising the data, i.e.:

Have

ID1     VARa     VARB

Want

ID1     VAR         RESULT

...       A               ...

...       B               ...

If so you can check out more or less the same post here:

New Contributor
Posts: 4

Re: Proc Report

How do I compute the statistics for each variable like in the above table and get it that format?

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