From: Al on

Dear All:
This is the sample spread sheet i have.

pat meds stdt spdt
111 ABC 1 .
111 CDE 130 150
111 NNN 132 140
111 GHI 160 170
111 LMN 165 .
111 OPQ 168 .
222 ABC 1 .
222 CBM 130 140
222 AAA 135 140
222 KHA 1 .
;
run;



I am trying to count the number of meds at different time points and
create three fields week 20,week 24 and diff
based on the following.

number of meds at week 20 = number of meds with no spdt and stdt = 1 +
any meds between (127(stdt) to 154(spdt)) + any meds between
(127(stdt) to 154(spdt)) and spdt = .

number of meds at week 24 = number of meds with no spdt and stdt = 1 +
any meds between (155(stdt) to 182(spdt)) + any meds between
(155(stdt) to 182(spdt)) and spdt = .

Ideally, this is what i am tring to get to ,one record per pat


Pat week 20 week 24 diff(week 24-week 20)
111 3 4 1
222 4 2 -2

I hope i wasnt confusing ..

Thanks in advance ..
Al

From: GS on
Al brought next idea :
> Dear All:
> This is the sample spread sheet i have.
>
> pat meds stdt spdt
> 111 ABC 1 .
> 111 CDE 130 150
> 111 NNN 132 140
> 111 GHI 160 170
> 111 LMN 165 .
> 111 OPQ 168 .
> 222 ABC 1 .
> 222 CBM 130 140
> 222 AAA 135 140
> 222 KHA 1 .
> ;
> run;
>
>
>
> I am trying to count the number of meds at different time points and
> create three fields week 20,week 24 and diff
> based on the following.
>
> number of meds at week 20 = number of meds with no spdt and stdt = 1 +
> any meds between (127(stdt) to 154(spdt)) + any meds between
> (127(stdt) to 154(spdt)) and spdt = .
>
> number of meds at week 24 = number of meds with no spdt and stdt = 1 +
> any meds between (155(stdt) to 182(spdt)) + any meds between
> (155(stdt) to 182(spdt)) and spdt = .
>
> Ideally, this is what i am tring to get to ,one record per pat
>
>
> Pat week 20 week 24 diff(week 24-week 20)
> 111 3 4 1
> 222 4 2 -2
>
> I hope i wasnt confusing ..
>
> Thanks in advance ..
> Al

Firstly, this NG is for VB Classic (v6 or lower).

Secondly, if you're working with a spreadsheet then maybe you're
looking for M$O VBA help. If so then you need to ask this question in
one of the Excel forums. In this case you might want to specify whether
you're looking for VBA to enter a formula that returns results to other
cells on the spreadsheet, OR if you just want to generate a report that
summarizes the results for you.

In the case of the latter, this could be a separate spreadsheet in the
same workbook that is populated via VBA or just uses cell formulas to
collect the results from your data spreadsheet. Someone in those M$O
forums should be able to provide a solution.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc