Mark
Mark

Reputation: 347

SAS Transpose Variable to Observations

I have a set of data which has multiple columns but only one observation.

I need to transpose the data to have multiple observations with 2 column of data.The very first column in my Data is the Status. I want this to be the 2nd column of data and all remaining columns observations labeled in a column called 'Category'

Proc tranpose data=RNAD_STG out=RNAD;by Status; Run;

I want it to look like this.

enter image description here

I've transposed from Observation to Variable before but the reverse has me stuck. What can I do to achieve my desired output?

Upvotes: 0

Views: 363

Answers (1)

Reeza
Reeza

Reputation: 21294

The log should state: NOTE: No variables to transpose.

Adding in a VAR statement solves this issue, either listing all variables, or a shortcut list or a wildcard list for all character variables.

Proc tranpose data=RNAD_STG out=RNAD (rename=(col1=status _name_=category));
by Status; 
var CH7--PPE2;
*var _character_;
Run;

Upvotes: 0

Related Questions