1
votes

I am a beginner so my knowledge is lacking. I have a data set consisting of the following columns:

  • Subject
  • Age
  • Height
  • Weight

I wish to create a table such that for every 1 person i have three rows called Age, Height, Weight.

I have tried to use Proc Tabulate :

proc tabulate data=new;

   class person;

   var NEWCOLUMN;

   table person,NEWCOLUMN;

run;

However i am getting an error because the new column is not the correct type.

1

1 Answers

2
votes

You can pivot the data per person and REPORT or TABULATE the cell values.

Example:

proc transpose data=sashelp.class out=pivoted;
  by name;
  var age height weight;
  where name <= 'C';
run;

ods html file='output.html' style=plateau;

options nodate nonumber nocenter;
title; footnote;

proc report data=pivoted;
  column name _name_ col1;
  define name / ' ' order order=data;
  define _name_ / ' ';
  define col1 / ' ';
run;

proc tabulate data=pivoted;
  class name _name_ / order=data;
  var col1;
  table name*_name_='', col1=''*min='' / nocellmerge;
run;

ods html close;

Output
enter image description here