LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (March 2012, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 23 Mar 2012 09:12:52 -0700
Reply-To:     Irin later <irinfigvam@yahoo.com>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Irin later <irinfigvam@YAHOO.COM>
Subject:      Re: Strange problem with dates !
Comments: To: Bolotin Yevgeniy <YBolotin@schools.nyc.gov>
In-Reply-To:  <01384B2401936142AF5F65E3D12402780C30F347@EX3VS1.nyced.org>
Content-Type: text/plain; charset=iso-8859-1

OMG! Yes,  Thank you! "Where"  clause works properly now!     However , calculation still does not work :( From: Bolotin Yevgeniy <YBolotin@schools.nyc.gov> To: Irin later <irinfigvam@yahoo.com>; SAS-L@LISTSERV.UGA.EDU Sent: Friday, March 23, 2012 12:06 PM Subject: RE: Strange problem with dates ! You have OR and AND logic on the same level Where (year 2010 check) OR (year 2011 check) AND (date compare) Add another set of parentheses to specify which one should go first -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Irin later Sent: Friday, March 23, 2012 11:45 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Strange problem with dates ! Actually  I used the following logic: Proc SQL; Create table Win14Time as select distinct a1.MemberPid ,a1.HospDischDate ,a2.claimid as OfficeClaimid ,a2.ServiceDateFrom as OfficeVisitDate ,a1.AdmitDate as AdmitHospt ,a1.LOSp ,a1.isPCP ,a1.PrimaryDiagnosisCode as HosptPrimDiag ,a2.PrimaryDiagnosisCode as OfficeVisitPrimDiag ,a1.EventID ,(a2.ServiceDateFrom-(a1.AdmitDate + a1.LOSp)) as TimeFrame FROM HospDischNoDup a1 INNER JOIN HosptAC_VisitNodup a2 on a1.memberPid=a2.memberPid where (year(datepart(a2.ServiceDateFrom))=2010 and month(datepart(a2.ServiceDateFrom))in (7,8,9,10,11,12)) or (year(datepart(a2.ServiceDateFrom))=2011 and month(datepart(a2.ServiceDateFrom))in (1,2,3,4,5,6)) and  a2.ServiceDateFrom >=  a1.AdmitDate; quit;   However , generated TimeFrame filed (number of day ) looks incorrect. Besides,  the very last statement "a2.ServiceDateFrom >=  a1.AdmitDate" does not work at all, does not restrict anything!!!!!   this is my Proc Contents . Perheps, I need to convert dates first? How can I resolve it: #    Variable                      Type      Len            Format              Informat        Label  6    AdmitHospt               Num       8               DATETIME     22.3             DATETIME22.3    AdmitDate 11    EventId                    Char       50              $50.                  $50.             EventId  3    HospDischDate          Num       8  9    HosptPrimDiag          Char       8                $8.                    $8.              PrimaryDiagnosisCode  8    IsPCP                        Char       1                $1.                    $1.              IsPCP  7    LOSp                         Num       8                11.                    11.              LOSp  1    MemberId                  Num       8                11.                    11.              MemberId  2    MemberNHPid           Char     15              $15.                   $15.             MemberNHPid  4    OfficeClaimid             Char     20              $20.                   $20.             ClaimId  5    OfficeVisitDate           Num      8               DATETIME     22.3              DATETIME22.3    ServiceDateFrom 10    OfficeVisitPrimDiag  Char      8                $8.                     $8.              PrimaryDiagnosisCode 12    TimeFrame               Num       8   Something is definetely wrong if a2.ServiceDateFrom >=  a1.AdmitDate does not work!!!!! What I am doing wrong? Could you please give me a hand? Thank you in advance,   Irin


Back to: Top of message | Previous page | Main SAS-L page