LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 2009, 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 Oct 2009 08:48:33 -0700
Reply-To:     Lipty <lipty.li@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Lipty <lipty.li@GMAIL.COM>
Organization: http://groups.google.com
Subject:      Re: How to make the dummy variable based on 3 criteria? Please
              help.
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1

Shiva,

Thank you very much. It seems work. I understand that you just ignore the branch. : )

Lipty

On Oct 23, 2:36 am, shiva <shiva.said...@gmail.com> wrote: > Hi lipty, > > I dont know is it an optimal solution.but try it out. > > Hope this helps > > data test; > input year hospital branch $ N ; > cards; > 1989 1 b1 22 > 1989 1 b2 23 > 1989 1 b3 22 > 1989 1 b4 24 > 1989 1 b5 24 > 1990 6 b1 55 > 1990 6 b2 33 > 1990 6 b4 77 > 1990 6 b5 33 > 1990 10 b2 66 > 1990 10 b3 66 > 1990 10 b4 66 > 1990 11 b2 67 > 1990 11 b3 67 > 1990 11 b4 67 > ; > run; > > proc sort data=test out=test1;by year hospital n;run; > > data final(keep = year hospital new); > set test1; > by year hospital n; > n1=lag(n); > if first.hospital then n1=.; > if lag(n1)=n then new=0; > else if last.hospital then new=1; > if last.hospital; > run; > > Thanks, > shiva


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