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!
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;
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?
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;
Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.
Explore Now →SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.