syntax:
call label(svar,namelabel); namelabel=vlabel(svar);
example(http://support.sas.com/kb/24/664.html):
/* Create dummy data */data one; input toy & $30. price type $; label toy='Hot Toys for 2000' price='Current Price' type='Regular or Sale Price';datalines;Tekno the Robotic Puppy 39.99 regularRazor B1 Scooter 119.99 regularMadeline Dollhouse 149.99 regularAmazing Baby in Lavendar 36.99 saleKick and Play Piano 24.99 regular;
data new; set one;
/* Array of all character variables */ array temp1 (*) _character_;
/* Array of all numeric variables */ array temp2 (*) _numeric_;
length newlabel $40;
/* For each element in the character array, assign its label */ /* as the value of NEWLABEL, and output the observation */ do i=1 to dim(temp1); call label(temp1(i),newlabel); /*newlabel=vlabel(temp1(i));*/ output; end;
/* For each element of the numeric array, assign its label as */ /* the value of NEWLABEL, and output the observation */ do j=1 to dim(temp2); call label(temp2(j),newlabel); /*newlabel=vlabel(temp2(j));*/ output; end; stop; keep newlabel;run;
proc print;run;