Date: Fri, 26 Jan 2007 09:21:53 -0500
Reply-To: sbarry@sbbworks.com
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Scott Barry <sbarry@SBBWORKS.COM>
Organization: SBBWorks, Inc.
Subject: Re: Any better way to simplify this code
Content-Type: text/plain; charset="us-ascii"
It may have been more useful to state your requirement or desired result rather than presuming the
readers can figure it out from your code.
From my perspective here is that it appears you want to count the year in which QUITDATE appears.
For that I would encourage you to consider PROC TRANSPOSE after extracting the YEAR portion from
QUITDATE. With TRANSPOSE, you can generate SAS numeric variables automatically based on the year,
with limited SAS code, then sum up those YRnnnn variables using PROC SUMMARY (with VAR statement an
generic SAS var specification YR: ). There are numerous SAS examples you can find on SAS.COM
support website.
Sincerely,
Scott Barry
SBBWorks, Inc.
On Jan 26, 4:57 am, soph...@HOTMAIL.COM (Sophia Tong) wrote:
> Dear SAS experts,
> I have the following code works fine, but wonder is there any better way to
> code them.
> Thanks,
> Sophia
> if '31dec89'd < QUITDATE < '01jan91'd then in1990=1;
> if '31dec90'd < QUITDATE < '01jan92'd then in1991=1;
> if '31dec91'd < QUITDATE < '01jan93'd then in1992=1;
> ......
> if '31dec04'd < QUITDATE < '01jan06'd then in2005=1;
|