| Date: | Thu, 4 Feb 2010 11:13:39 -0500 |
| Reply-To: | Nathaniel Wooding <nathaniel.wooding@DOM.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Nathaniel Wooding <nathaniel.wooding@DOM.COM> |
| Subject: | Re: Parsing out Dates |
| In-Reply-To: | <201002041605.o14BlNUq013199@malibu.cc.uga.edu> |
| Content-Type: | text/plain; charset="us-ascii" |
Billy
Sometimes the major part of the problem is figuring out how to couch the question.
If you print a few lines or (assuming that you are on windows) , open the explorer window and click on your file, you will see this particular variable. If the values are on the order of 12,000 and above (assuming that they start in 1994) then you have a sas date value. Hence, you can refer to a given value using SAS date literal format as in
'01jan1994'd which stands for Jan 1, 1994, or 12,419
Hence, your code should be
if ratedpilotsnew2 le '12/31/1994'D then date = 0; else date = 1; * letter d added to date value;
Try using the single line statement that I gave you. If it works, it really simplifies the coding if you are looking at many years.
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Billy Thompson
Sent: Thursday, February 04, 2010 11:06 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Parsing out Dates
Nat,
Proc Contents identifies the date variable as numeric. The actual code I
originally tried was
if ratedpilotsnew2 le '12/31/1994' then date = 0; else date = 1;
this was just an attempt to see if it worked and I could get two
groupings. If it did I would then parse out each year through 2009.
BTW, thanks everyone for helping inspite of my not communicating exactly
what it is I need to do. Thanks for your patience.
CONFIDENTIALITY NOTICE: This electronic message contains
information which may be legally confidential and or privileged and
does not in any case represent a firm ENERGY COMMODITY bid or offer
relating thereto which binds the sender without an additional
express written confirmation to that effect. The information is
intended solely for the individual or entity named above and access
by anyone else is unauthorized. If you are not the intended
recipient, any disclosure, copying, distribution, or use of the
contents of this information is prohibited and may be unlawful. If
you have received this electronic transmission in error, please
reply immediately to the sender that you have received the message
in error, and delete it. Thank you.
|