| Date: | Mon, 6 Feb 2006 23:26:16 -0500 |
| Reply-To: | Arthur Tabachneck <art297@NETSCAPE.NET> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Arthur Tabachneck <art297@NETSCAPE.NET> |
| Subject: | Re: How to Identify Consecutive Visits |
|
Tony,
Your code will count days regardless of whether they are consecutive.
Art
-------------
On Mon, 6 Feb 2006 23:18:13 -0500, Tony Yang <tonyyangsxz@GMAIL.COM> wrote:
>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
|