Help using Base SAS procedures

Transposing a single variable.

Reply
N/A
Posts: 0

Transposing a single variable.

My data set Names have only one variable, Person, like this:

Person
********
Adam
Eve
Ask
Embla

With the code:

proc transpose data=names out=names prefix=Name;
var person;
run;


I get:

_NAME_ _LABEL_ Name1 Name2 Name 3 Name4
person personlabel Adam Eve Ask Embla

In a data statement I can drop _NAME_ and _LABEL_, so I get what I want:

Name1 Name2 Name3 Name4
Adam Eve Ask Embla

Could that have been done directly in proc transpose?
Super Contributor
Posts: 474

Re: Transposing a single variable.

Yes.

You should specify the drop statement at the output table, like this:

[pre]proc transpose data=names out=names (drop = _Smiley Happy prefix=Name;
var person;
run;[/pre]

drop = _: is actually a wildcard (_*) , it works like drop any variable that stars with _

Cheers from portugal.

Daniel Santos @ www.cgd.pt
Ask a Question
Discussion stats
  • 1 reply
  • 95 views
  • 0 likes
  • 2 in conversation