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 (February 2006, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 6 Feb 2006 23:18:13 -0500
Reply-To:     Tony Yang <tonyyangsxz@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Tony Yang <tonyyangsxz@GMAIL.COM>
Subject:      Re: How to Identify Consecutive Visits
Comments: To: jack quin <qinlixun@gmail.com>
In-Reply-To:  <585dd74f0602061944h5e824753y6eaed914335fc8cf@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Hi, *Jack;* You can try the following idea:

data visit; set patient;

array day{*} day1-day10; visit=0; do i=1 to dim(day); if day{i}=1 then do; visit=visit+1; end; end;

proc print data=visit; run;

the new variable visit will count the number of visit for each patient, based on this, you then can get the information you need.

Hope this helps.

On 2/6/06, jack quin <qinlixun@gmail.com> wrote: > > Hi, SAS-L, > > I have a dataset which list each patience visits during 10 days. I want to > known how many patience make at least 3 consecutive visits, at least 5 > consecutive visits, at least 10 consecutive visits. Here is the dataset: > > Patience id day1 day2 day3 day4 day5 day6 day7 day8 > day9 day10 > 1001 1 1 0 1 1 1 > 0 0 0 0 ----- this > patience has at least 3 consecutive visits > 1002 1 1 1 1 1 0 > 0 1 1 1 ------ this > patience has at least 5 consecutive visits > 1003 1 1 1 1 1 1 > 1 1 1 1 ------ this > patience has at least 10 consecutive visits > 1004 1 1 0 0 0 0 > 0 0 0 0 -------- no 3 > consecutive visits > ..... > > > I want to create a flag: 1: at least 10 consecutive visits; 2: at least 5 > consecutive visits; 3 at least 3 consecutive visits; 4 less than 3 > consecutive visits/no visits. > > Do you know how I can create it? > > > Thanks in advance. >

-- Best regards, Tony


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