Applying Labels From one SAS Variable to Another Varaiable.

Reply
Contributor
Posts: 32

Applying Labels From one SAS Variable to Another Varaiable.

data works._RefDate__;

set works._RefDate_   end=eof;

if eof then call execute('data &syslast; set &syslast;');

if eof then call execute('label  AEENDY = "relative day of ' || strip(vlabel(AEENDT)) || '";');

if eof then call execute('run;');

run;

log :

NOTE: CALL EXECUTE generated line.

1    + data WORKS._REFDATE_                       ; set WORKS._REFDATE_                       ;

2    + label  AEENDY = "relative day of End Date of Adverse Event";

3    + run;

But the issue is the variable  AEENDY  is not assigned the label in SAS Data set,but its showing log.can some help me.

Grand Advisor
Posts: 10,210

Re: Applying Labels From one SAS Variable to Another Varaiable.

Get the value of the label into another variable and use call label instead of label:

NewLabel = catx(' ','relative day of',vlabel(aeendt));

call label (aeendy,NewLabel);

I don't think you even need to go the call execute or worry about EOF part.

Contributor
Posts: 32

Re: Applying Labels From one SAS Variable to Another Varaiable.

Capture.PNG

Contributor
Posts: 32

Re: Applying Labels From one SAS Variable to Another Varaiable.

data works._RefDate__;

set works._RefDate_;

NewLabel = catx(' ','relative day of',vlabel(AEENDT));

call label (AEENDY,NewLabel);

run;

Grand Advisor
Posts: 17,329

Re: Applying Labels From one SAS Variable to Another Varaiable.

Unfortunately call label doesnt work that way afaik. Its a feature that sorely needs to be added.

Your original code should have worked.

Please post a proc contents before and after the run. When you rename datasets with the same name it can be difficult to debug. Or try using a proc datasets to apply the label instead of a data step.

Contributor
Posts: 32

Re: Applying Labels From one SAS Variable to Another Varaiable.

Thank you !!

Ask a Question
Discussion stats
  • 5 replies
  • 232 views
  • 1 like
  • 3 in conversation