call label and vlabel

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  regular
Razor B1 Scooter  119.99  regular
Madeline Dollhouse  149.99  regular
Amazing Baby in Lavendar  36.99  sale
Kick 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;

你可能感兴趣的:(input,character,each,output,variables)