Help using Base SAS procedures

How do I get the variable names to show vertically, not horizontally in a dataset and/or excel output file

Reply
Occasional Contributor
Posts: 6

How do I get the variable names to show vertically, not horizontally in a dataset and/or excel output file


Hi

my dataset shows with variable names horizontally across the top and values listed vertically underneath

BD     OD     CD     DD

1          a     t          15

1          d     t          12

1          c     y          13

         

but I want it to show variable names vertically down the left side and values listed horizontally

BD     1         1          1

OD     a         d         c

CD     t          t          y

DD     15       12       15

I am dealing with a dataset of much more data than the example above and want it displayed this way to fit on an A4 page when printed

In my program I am doing a proc export to excel

thanks

Super User
Posts: 17,828

Re: How do I get the variable names to show vertically, not horizontally in a dataset and/or excel output file

Use proc transpose to flip your data before you export it.

Occasional Contributor
Posts: 6

Re: How do I get the variable names to show vertically, not horizontally in a dataset and/or excel output file

thanks for the quick reply, can u show me how to write it using the above example ?

Contributor dkb
Contributor
Posts: 53

Re: How do I get the variable names to show vertically, not horizontally in a dataset and/or excel output file

data have;

  input BD OD $ CD $ DD;

  datalines;

1          a     t          15

1          d     t          12

1          c     y          13

;

run;

proc transpose data= have

  out=want;

  var BD OD CD DD;

run;

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