home *** CD-ROM | disk | FTP | other *** search
- Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
- Path: sparky!uunet!stanford.edu!bcm!rice!newsfeed.rice.edu!wupost!darwin.sura.net!paladin.american.edu!auvm!LOBBY.TI.COM!RSNYDER
- X-Mailer: ELM [version 2.2 PL16]
- Message-ID: <9211062054.AA22871@lobby.ti.com>
- Newsgroups: bit.listserv.sas-l
- Date: Fri, 6 Nov 1992 14:54:12 CST
- Reply-To: "(R. Snyder)" <rsnyder@LOBBY.TI.COM>
- Sender: "SAS(r) Discussion" <SAS-L@UGA.BITNET>
- From: "(R. Snyder)" <rsnyder@LOBBY.TI.COM>
- Subject: Re: Suggestions sought for a computation problem
- Comments: To: GFX@PSUVM.PSU.EDU
- Comments: cc: sas-l@uga.cc.uga.edu
- In-Reply-To: <9211062011.AA21461@lobby.ti.com>; from "GFX@PSUVM.PSU.EDU" at
- Nov 6, 92 2:18 pm
- Lines: 57
-
- SUBJECT: Date computations.
- SUMMARY: More info needed but, some sql code anyway.
- REL/PLTF: 6.07/HP300
- E-ADDR: rsnyder@lobby.ti.com
- NAME: Bob Snyder
- COMPANY: Texas Instruments, Sherman, TX
- PHONE: (903) 868-5799
- FAX: (903) 868-7240
- >
- > The dataset is structured like this:
- >
- > OBS Date x1 x2 ... xn N_12Mo
- > 1 04/12/82 1 0 1
- > 2 04/21/82 1 1 0
- > 3 04/28/82 0 0 1
- > .
- > .
- > .
- > K
- >
- > Variable N_12Mo should indicate the number of observations that are
- > less than a year old. In other words, how many lines above observation K
- > are less than a year old. We used the LOOKUP procedure in Microsoft Excel.
- > How could it be done in SAS?
- >
- Stephane,
-
- Has your date been recoded as a numeric SAS date value or is it in character
- form?
-
- If it is in character form you may do the following:
-
- data new;
-
- length SASDate 8;
- informat SASDate date7.;
- format SASDate date7.;
- drop Date;
- set old;
- SASDate = input( Date, mmddyy8. );
-
- run;
-
- Now, to set N_12Mo:
-
- proc sql;
-
- select count(*) into :N_12Mo
- from new
- where month(SASDate) lt ( month(date()) + 12 )
- ;
-
- Now the macro variable N_12Mo contains the number of files less than 12
- months old.
-
- I hope I helped.
- Bob
-