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 (June 2006, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 28 Jun 2006 11:42:41 -0400
Reply-To:   Jim Groeneveld <jim2stat@YAHOO.CO.UK>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Jim Groeneveld <jim2stat@YAHOO.CO.UK>
Subject:   Re: duplicate schemes
Comments:   To: Dirk Nachbar <Dirk.Nachbar@DWP.GSI.GOV.UK>

Hi Dirk,

Never use a LAG function in a condition. Your second LAG function may not be processed if the first part of the condition already is FALSE. This has been stated many times on this list, including why (but that is a longer story).

In your case use either a data step with an ARRAY of desired size and accompanying DO loop, PROC TRANSPOSE or my macro MR2RM (see another posting of mine from today).

Regards - Jim. -- Jim Groeneveld, Netherlands Statistician, SAS consultant home.hccnet.nl/jim.groeneveld

P.S. Train to catch...........

On Wed, 28 Jun 2006 16:31:14 +0100, Dirk Nachbar <Dirk.Nachbar@DWP.GSI.GOV.UK> wrote:

>Dear all > >I have a dataset with many people (ccnino) over many years (cntaxyear). some >people have more than one entry per year. I want to create a variable scheme2 >which stores the value from the second entry per person and year. the code >below doesn't seem to work. should i use a proc sort with nodupkey and then >re-merge? there might also be gaps between years. > >data penid; >set penid; >by ccnino cntaxyear; >if first.cntaxyear then scheme1=schtype; >if lag(first.cntaxyear) and schtype^=lag(schtype) then scheme2=schtype; >run; > >Dirk Nachbar >Assistant Economist >Pensim2 >Department for Work and Pensions >Level 4, The Adelphi >1-11 John Adam St >WC2N 6HT London >020 796 28531 >********************************************************************** >This document is strictly confidential and is intended only for use by the addressee. >If you are not the intended recipient, any disclosure, copying, distribution or other >action taken in reliance of the information contained in this e-mail is strictly prohibited. >Any views expressed by the sender of this message are not necessarily those of the Department >for Work and Pensions. >If you have received this transmission in error, please use the reply function to tell us >and then permanently delete what you have received. >Please note: Incoming and outgoing e-mail messages are routinely monitored for compliance >with our policy on the use of electronic communications. >********************************************************************** > > > >The original of this email was scanned for viruses by Government Secure Intranet (GSi) virus scanning service supplied exclusively by Cable & Wireless in partnership with MessageLabs. >On leaving the GSI this email was certified virus free. >The MessageLabs Anti Virus Service is the first managed service to achieve the CSIA Claims Tested Mark (CCTM Certificate Number 2006/04/0007), the UK Government quality mark initiative for information security products and services. For more information about this please visit www.cctmark.gov.uk


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