proc report header labelling

Reply
Frequent Contributor
Posts: 85

proc report header labelling


i have a dataset

sno name m1 m2 s1 s2 e1 e1

1 A 20 30 25 45 26 27

1 B 25 32 55 20 41 25

1 C 27 40 28 44 46 37

1 D 29 50 35 42 36 42

i want output as

______________________________________________________________

|                   |          maths         |     Science             |     English             |

|SNo    name |  maths1| maths2  |science1 | science2  | english1|  english2|

|                    |           (1)           |           (2)                |         (3)                |

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

|1         A           20          30              25           45           26       27          |

|1         B           25          32             55           20           41        25          |

|1         C           27          40             28           44           46       37           |

|1         D           29          50             35           42           36          42        |

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

i want 1st level header as (1) (2) (3)

2nd level header as  maths1  maths2  |science1   science2  | english1   english2

3rd level headers as maths              Science                  English           

Esteemed Advisor
Esteemed Advisor
Posts: 7,253

Re: proc report header labelling

Use a split char:

proc report split="~"...   /* Note the split=, you can put any character within the quotes */

     column ....;

     define sno / "SNo";

     define name / "Name";

     define m1/ "maths~maths1|maths2~(1)";   /* Note the tilde which indicates to line break */

     define m2 / "Science~science1|science2~(2)";

...

Super User
Posts: 1,117

Re: proc report header labelling

Please try

data have;

input

sno name $ m1 m2 s1 s2 e1 e1;

cards;

1 A 20 30 25 45 26 27

1 B 25 32 55 20 41 25

1 C 27 40 28 44 46 37

1 D 29 50 35 42 36 42

;

run;

ods rtf file='~\new.rtf';

proc report data = have nowindows headline headskip split='/' style(header)={just=c};

column ('Sno' sno) ('Name' name) ("Maths/Maths1|Maths2/(1)"  m1 m2 ) (  "science/science1|science2/(2)" s1 s2)  ( "english/english|english/(3)" e1 e2);

define sno / '';

define name / '';

define m1 / '';

define m2 / '';

define s1 / '';

define s2 / '';

define e1 / '';

define e2 / '';

run;

ods rtf close;

Thanks,

Jag

Thanks,
Jag
Frequent Contributor
Posts: 85

Re: proc report header labelling

i want output as

______________________________________________________________

|                   |          maths         |     Science             |     English             |

|------------------------------------------------------------------------------------------------------------|

|SNo    name |  maths1| maths2  |science1 | science2  | english1|  english2 |

|------------------------------------------------------------------------------------------------------------|

|                   |           (1)            |           (2)                |         (3)                 |

|------------------------------------------------------------------------------------------------------------|

|1         A           20          30              25           45           26       27          |

|1         B           25          32             55           20           41        25          |

|1         C           27          40             28           44           46       37           |

|1         D           29          50             35           42           36          42        |

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

This is tablar format

1st heading above colunm will be (1) (2) (3)

above it seperate cels for Above M1 Maths1 and above M2 Maths2 so on

and above it maths science and englesh

i used | on to distingulish cells

Esteemed Advisor
Esteemed Advisor
Posts: 7,253

Re: proc report header labelling

As far as I am aware you cant have "across" labels, which is what the maths, science, and (1) (2), over *and* under other labels, only above column labels.  Then point being that information applies to all deceding column headers.  You could however fake it pretty easily:

data have;

input

sno name $ m1 m2 s1 s2 e1 e2;

cards;

1 A 20 30 25 45 26 27

1 B 25 32 55 20 41 25

1 C 27 40 28 44 46 37

1 D 29 50 35 42 36 42

;

run;

data inter (keep=sno name m s e);

  set have;

  length m s e $25;

  m=put(m1,2.)||right(put(m2,16.));

  s=put(s1,2.)||right(put(s2,16.));

  e=put(e1,2.)||right(put(e2,16.));

run;

ods pdf file="s:\temp\rob.pdf" style=statistical;

proc report data=inter split="~" nowd;

  column (' ' sno name) ('maths' m) ('science' s) ('english' e);

  define sno / "SNo" style(header)=[just=l];

  define name / "name" style(header)=[just=r];

  define m / "maths1|maths2~(1)" style(header)=[just=c];

  define s / "science1|science2~(2)" style(header)=[just=c];

  define e / "english1|english2~(3)" style(header)=[just=c];

run;

ods _all_ close;

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