Re: I didn't know format and labels could be used with 'proc

  • Follow


I too enjoy those moments when I say, "Wow! I didn't know that."   And
I�ve said that a lot since I became an active participant in SAS-L. Or
when I write some program I think is "so special" and someone says
"There's a function for that".

Similarly you can influence the OUT= data set from PROC CONTENTS.
Which I suppose could be considered counter intuitive.

proc format;
   value $sex 'M'='Male' 'F'='Female';
   run;
proc contents noprint fmtlen
      data=sashelp.class(label='Data Class' sortedby=name)
      out=contents
      ;
   label sex="Label on output dataset";
   format age z3. sex $sex.;
   run;
proc print;
   var memname--formatd sorted:;
   run;




On 3/5/10, xlr82sas <xlr82sas@aol.com> wrote:
> Hi SAS-Lers,
>
>  I was a little surprised, others probably new this, but
>
> proc sort data=sashelp.class  out=class;
>  label name="New label";
>    format age z3.;
>   informat _all_;
>   by name;
> run;
>
> Output CLASS dataset
>
> Alphabetic List of Variables and Attributes
>
>  Variable    Type    Len    Format    Label
>
>  AGE         Num       8    Z3.
>  HEIGHT      Num       8
>  NAME        Char      8              New label
>  SEX         Char      1
>
> proc transpose data=sashelp.class out=clsxpo;
>  label name="Transpose label";
>  format name $char19.;
>  informat _all_;
>  by name;
>  var sex;
> run;
>
> Alphabetic List of Variables and Attributes
>
> Variable    Type    Len    Format      Label
>
> COL1        Char      1
> NAME        Char      8    $CHAR19.    Transpose label
> _NAME_      Char      8                NAME OF FORMER VARIABLE
>
>
> proc means data=sashelp.class;
> label sex="Label on output dataset";
> format age z3.;
> class sex;
> var age;
> output out=class mean=age;
> run;
>
> Variable    Type    Len    Format    Label
>
> AGE         Num       8    Z3.
> SEX         Char      1              Label on output dataset
> _FREQ_      Num       8
> _TYPE_      Num       8
>
0
Reply iebupdte (1746) 3/5/2010 3:32:35 PM


0 Replies
24 Views

(page loaded in 0.049 seconds)


Reply: