| Date: | Fri, 21 Jul 2006 10:27:53 -0700 |
| Reply-To: | sdlenter <sdlentert@AOL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | sdlenter <sdlentert@AOL.COM> |
| Organization: | http://groups.google.com |
| Subject: | Re: Dates - count |
|
| In-Reply-To: | <1153457656.994161.190130@h48g2000cwc.googlegroups.com> |
| Content-Type: | text/plain; charset="iso-8859-1" |
|---|
that didn't work
120 proc format;
121 value RangeFmt 1 - high ='1 Year Old'
122 2 - high ='2 Years Old'
123 3 - high ='3 Years Old'
124 5 - high ='5 Years Old'
125 10 - high ='10 Years Old'
126 run;
ERROR: These two ranges overlap: 1-HIGH and 2-HIGH (fuzz=1E-12).
ERROR: These two ranges overlap: .-HIGH and 3-HIGH (fuzz=1E-12).
ERROR: These two ranges overlap: .-HIGH and 5-HIGH (fuzz=1E-12).
ERROR: These two ranges overlap: .-HIGH and 10-HIGH (fuzz=1E-12).
NOTE: The previous statement has been deleted.
NickyNN wrote:
> Would you like a count of the number of years from today's date ?
>
> How about something like this:
>
> proc format ;
> value RangeFmt (multilabel)
> 0="0 Year Old"
> 1-high="1 Year Old"
> 2-high="2 Year Old"
> 3-high="3 Year Old"
> 5-high="5 Year Old"
> 10-high="10 Year Old";
> run;
>
> data TestData;
> input CharDate $ ;
>
> SASDate = input(CharDate,yymmdd8.);
> Today=today() ;
> YearsOld=year(Today)-year(SASDate) ;
>
> format SASDate Today Date7.;
> cards;
> 20051111
> 20041016
> 20030102
> 19990518
> 19990610
> 20001231
> 20010101
> 20010317
> 20011224
> 19800101
> 19800102
> ;
> run;
>
> proc sort data=TestData ;
> by descending SASDate ;
> run ;
>
> proc summary data=Testdata nway ;
> class YearsOld / mlf order=Data;
> Var SASDate ;
> format YearsOld RangeFmt. ;
> output out=DateCounts (drop=_type_ _freq_) n=DateCounts;
> run ;
>
> proc print data=SummaryCounts ;
> run;
>
> Cheers,
> Nicky.
|