|
Hi Wood,
Great help. I have learnt from you.Toby also suggested me very nicely.
A little Confusion. I couldn't have explained exactly. I need to write
05-09-05 or 05/09/06 like formats in badguys. And Null values of
Account numbers also.( I need to write year two digit values will write
in badguys.)
All the four digit year date values should write in x except Account
number have Null values.
If possible please write again. I check tomorrow morning.
Thanks much... I am a lucky person got immediately answer from you.
Vj.
Nat Wooding wrote:
> VJ
>
> This is basically what Toby suggested. I left the two variables Test1 and
> Test2 in the final set just so you could see what they looked like. You
> could actually write the program without creating the two variables but I
> like to actually be able to see them.
>
> Nat Wooding
>
> DATA X badguys;
> informat Acctnum $5. invdate invduedt $10.;
> INPUT Acctnum invdate invduedt ;
> * do not read these using sas informats since that converts them to SAS
> dates and you will
> not be able to check for the original formating.;
> /*
> INVDATE MMDDYY8.
> INVDUEDT MMDDYY8.
> ; */
> if acctnum = ' ' then output badguys;
> else if (index(invdate,'-') or index(invduedt,'-') ) then output badguys ;
> else do;
> test1=scan(invdate,3,'/');
> test2=scan(invduedt,3,'/');
> if length(test1) lt 4 or length(test2) lt 4 then output badguys;
> else output x;
> end;
> CARDS;
> A123 1/7/2004 2/29/2004
> B234 3/8/2004 4/8/2004
> C1122 05-09-05 4/8/2004
> D2233 3/8/2004 03/09/04
> . 3/8/2004 4/8/2004
> . 3/9/2004 5/9/2004
> . 2/8/2004 4/6/2004
> . 4/8/2004 6/5/2004
> C1122 02-09-06 4/8/2004
> D2233 3/8/2004 03/09/08
> ;
>
> proc print data=x;title 'set x';
> proc print data=badguys;title 'set badguys';
> run;
>
>
>
> vj
> <vijay_sas@HOTMAI
> L.COM> To
> Sent by: "SAS(r) SAS-L@LISTSERV.UGA.EDU
> Discussion" cc
> <SAS-L@LISTSERV.U
> GA.EDU> Subject
> This is regarding DATE format
>
> 10/04/2006 12:01
> PM
>
>
> Please respond to
> vj
> <vijay_sas@HOTMAI
> L.COM>
>
>
>
>
>
>
> Hi All,
> Please help me to finish this query.
> I have three variables in a dataset and I have to remove null values of
> acctnum and I want to abend if the invdate, invduedt is like mm-dd-yy
> or mm/dd/yy.
>
>
> Example:
>
> DATA X;
> INPUT Acctnum $20.
> INVDATE MMDDYY8.
> INVDUEDT MMDDYY8.
> ;
> CARDS;
> A123 1/7/2004 2/29/2004
> B234 3/8/2004 4/8/2004
> C1122 05-09-05 4/8/2004
> D2233 3/8/2004 03/09/04
> . 3/8/2004 4/8/2004
> . 3/9/2004 5/9/2004
> . 2/8/2004 4/6/2004
> . 4/8/2004 6/5/2004
> C1122 02-09-06 4/8/2004
> D2233 3/8/2004 03/09/08
> ;
> RUN;
>
> i) i want to delete the records which have Acctnum is NULL.
> ii) I want to abend if the data have 05-09-05(mm-dd-yy) format or
> like 01/02/05 (mm/dd/yy)format.
> I mean can write to abend file.
>
> Please help me to write this program..
> Thank you very much in Advance..
> Can you please mail me Urgent.
>
>
>
> -----------------------------------------
> 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.
|