- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I transposed the following data and included DROP = _NAME_ to drop the variable that was formerly used to describe the labels of a set of values:
Original list of variables: SSN, VisitDt, Measure, Value
PROC TRANSPOSE
DATA = WORK.V1
OUT = WORK.V2 (DROP = _NAME_
RENAME = (COL1 = HtIn
COL2 = WtKg
COL3 = SBP
COL4 = DBP)
);
VAR Value;
BY SSN VisitDt;
RUN;
The new list of variables is: SSN, VisitDt, _LABEL_, HtIn, WtKg, SBP, DBP
Why is _LABEL_ in the output? Shouldn't it have dropped? Any ideas on how to fix this? Thx!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If no other variables in output start with "_", then drop all _NAME_ _LABEL_ by specifying DROP= _:
Example:
proc transpose data=sashelp.class out=want(drop=_:);
by name;
id sex;
var height;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
FYI - personally I'd consider it dangerous to rename variables in that fashion, I'd highly recommend the usage of an ID and/or IDLABEL statement in your PROC TRANSPOSE code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
That's good to know. I was taught that it improves efficiency to rename in the set statement. Is the concern incorrectly renaming a variable and making it permanent?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If no other variables in output start with "_", then drop all _NAME_ _LABEL_ by specifying DROP= _:
Example:
proc transpose data=sashelp.class out=want(drop=_:);
by name;
id sex;
var height;
run;