home *** CD-ROM | disk | FTP | other *** search
- Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
- Path: sparky!uunet!paladin.american.edu!auvm!STACC.MED.UTAH.EDU!KNECHOD
- Mailer: Elm [revision: 66.33]
- Message-ID: <SAS-L%92072716125509@UGA.CC.UGA.EDU>
- Newsgroups: bit.listserv.sas-l
- Date: Mon, 27 Jul 1992 14:15:40 MDT
- Reply-To: knechod@stacc.med.utah.edu
- Sender: "SAS(r) Discussion" <SAS-L@UGA.BITNET>
- From: Kevin Nechodom <knechod@STACC.MED.UTAH.EDU>
- Subject: Date Selection with Data Steps
- Comments: To: SAS Mailing List <sas-l@uga.cc.uga.edu>
- Lines: 61
-
- I am trying to write a data step script that will select a subset of
- records out of a data set that has each record dated.
-
- Data Set
- --------
- Date
- Received Data ...
- 02/03/92 ....
- 05/04/92 ....
- 03/29/91 ....
-
- I would like to make it easy for whoever uses this script to change
- the cutoff date.
-
- 1. I think I can put the date into a data step that puts the date
- into its own data set. Then merge that date with my actual data
- into a temp data set. Then use a WHERE clause to select out the
- appropriate records.
-
- Data tempdate;
- input cutoff mmddyy8.;
- cards;
- 04/15/92
- ;
- data workmrge;
- .
- .
- .
-
- 2. Another approach which I used in an emergency was to use the
- DATEJUL function.
-
- data work.junk;
- length cutoff 4;
- cutoff = datejul(92185); /* I do NOT like this! It's not simple! */
- set prod.airheum;
- ;
- run;
- data WORK.FREQ;
- set work.junk;
- where recdate <= cutoff;
- .
- .
- .
-
-
- I would like to avoid writing intermediate data sets and calculating
- days-of-the-year. Is there anything like the SCL INPUTN function that
- returns:
-
- cutoff = INPUTN("04/15/92","mmddyy8.");
-
- that I could use within the data step and a WHERE clause?
-
- Prethanks for the mental bandwidth.
-
- --
- Kevin Nechodom UofU STACC | Great Moments in Physics History:
- UofU doesn't even know I exist; | "E= m c cubed? No, too gaudy.
- how would they care what I say? | E= m c ? No, too simple.
- knechod@stacc.med.utah.edu | E= m c squared? Ah, ha!"
-