Date: Thu, 28 Jul 2005 17:04:59 -0400
Reply-To: "A.B." <alicia.bingo@gmail.com>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "A.B." <alicia.bingo@GMAIL.COM>
Subject: Re: How to show date in its proper format in Proc means
In-Reply-To: <200507271804.j6RI4Z9K011348@listserv.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1
Thanks Howard. Proc Tabulate does work better in this case.
A.B.
On 7/27/05, Howard Schreier <hs AT dc-sug DOT org> <nospam@howles.com> wrote:
> My first choice would probably be PROC TABULATE. It can do all of the stats
> which PROC MEANS can do, but it also offers a great deal of control over
> the presentation. For example:
>
> proc tabulate data=sashelp.retail;
> var date;
> table min max , date * f=yyq4. ;
> run;
>
> On Tue, 26 Jul 2005 19:04:11 -0400, Ya Huang <ya.huang@AMYLIN.COM> wrote:
>
> >I can think of two methods:
> >
> >1. Use sql:
> >
> >proc sql;
> >select min(date) format=date.,
> > max(date) format=date.
> >from temp
> >;
> >
> > ----------------
> > 17MAR31 14OCT99
> >
> >
> >2. Use prod template to change to format:
> >
> >proc template;
> > edit base.summary;
> > define min;
> > header = "Min";
> > generic;
> > format=date.;
> > end;
> > define max;
> > header = "Max";
> > generic;
> > format=date.;
> > end;
> > end;
> >run;
> >
> >proc means data=temp min max;
> > var date;
> >run;
> >
> > The MEANS Procedure
> >
> > Analysis Variable : date
> >
> > Min Max
> > ----------------------------
> > 17MAR1931 14OCT1999
> > ----------------------------
> >
> >
> >Kind regards,
> >
> >Ya Huang
> >
> >On Tue, 26 Jul 2005 17:54:02 -0400, A.B. <alicia.bingo@GMAIL.COM> wrote:
> >
> >>Dear all,
> >>
> >>I have a data set that contains some date variables (data type would
> >>be numeric). When I tried to see the newest and oldest date using Proc
> >>means max and min option, it gave me the numbers instead in date
> >>format even if I specified the format.
> >>
> >>For example:
> >>
> >>data temp;
> >>input date yymmdd8.;
> >>cards;
> >>19310317
> >>19681224
> >>19651128
> >>19990914
> >>19991014
> >>19990912
> >>;
> >>run;
> >>
> >>/*proc print data=temp ;format date yymmdd10.;run;*/
> >>proc means data=temp min max;
> >> var date;
> >> format date yymmdd8.;
> >>run;
> >>
> >>The actual output:
> >> Analysis Variable : date
> >>
> >> Minimum Maximum
> >> ------------------------------------------
> -
> >--
> >> -10517.00 14531.00
> >>
> >>What I want it to be:
> >> Minimum Maximum
> >> ------------------------------------------
> -
> >--
> >> 1931-03-17 1999-10-14
> >>
> >>Is there a way to do it?
> >>
> >>Thanks in advance.
> >>--
> >>A.B.
>
--
A.B.
|