Date: Fri, 5 Dec 2008 16:40:46 -0600
Reply-To: Robin R High <rhigh@UNMC.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Robin R High <rhigh@UNMC.EDU>
Subject: Re: PROC LOGISTIC: how to run with data with frequencies?
In-Reply-To: <019301c95721$dddd3990$832fa8c0@HP82083701405>
Content-Type: text/plain; charset="US-ASCII"
Mary,
Just add the frequency represented by each record on a FREQ statement:
proc logistic data=test desc;
class allele / param=ref;
model disease = allele;
freq freq;
run;
Robin High
UNMC
Mary <mlhoward@AVALON.NET>
Sent by: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
12/05/2008 03:40 PM
Please respond to
Mary <mlhoward@avalon.net>
To
SAS-L@LISTSERV.UGA.EDU
cc
Subject
PROC LOGISTIC: how to run with data with frequencies?
I know I've seen it before, but can't seem to find this.
Is there a way to run PROC LOGISTIC using frequencies instead of
observation-level data? I've got data like this:
data test;
informat allele $1.;
infile cards;
input allele disease freq;
cards;
A 0 353
A 1 280
B 0 424
B 1 323
run;
That I want to run a model of disease=allele with.
Does anyone know how to do this?
-Mary
----- Original Message -----
From: Cornel Lencar
To: SAS-L@LISTSERV.UGA.EDU
Sent: Friday, December 05, 2008 3:17 PM
Subject: Re: tphreg with time-varying covariates
Hi Deb,
Try this approach in your model statement:
do i = 1 to dim(mxs);
if mxs{i} ne . and mxdts{i} ne . and mxdts{i} lt evdt then t_cd =
mxs{i};
t_cd4cat=1*(tcd ge 0 and t_cd lt 200) + 2*(t_cd ge 200 and t_cd le
349) + 3*(t_cd ge 350 and t_cd le 499) + 4 *(t_cd ge 500 and t_cd le 649)
+
5*( t_cd ge 650);
end;
In your initial code, the variable t_cd4cat was built outside the array so
the model actually didn't see it. Now I think it should work.
Cheers,
Cornel
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Kevin
Viel
Sent: Friday, December 05, 2008 1:00 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: tphreg with time-varying covariates
On Thu, 4 Dec 2008 09:29:24 -0600, Deborah Wentworth <debby@CCBR.UMN.EDU>
wrote:
>Greetings -
>
>I am trying to run my first tphreg model. It's complicated by the fact
>that I have a time-varying covariate.
>
>I cannot find an example of the syntex. The log tells me that "variable
>T_CD4CAT not found".
>
>My code is below. Can someone tell me if I have the incorrect syntax for
>what I am trying to do? Because if's my first stab at tphreg ever, I
>may not be correctly interpreting use of the contrast statement.
>
>Your help would be much appreciated!
>
>Thanks, Deb
>
>proc tphreg data=events;
>class gpa t_cd4cat / ref=first ;
>model t2dth * dth(0) = gpA t_cd4cat gpA*t_cd4cat / risklimits;
>
>contrast 'GpA CD4 cat 1' gpa 1 / estimate=exp;
>contrast 'GpA CD4 cat 2' gpa 1 gpa*t_cd4cat 1 0 0 0 / estimate=exp;
>
>array mxdts{*} mxdt1-mxdt32;
>array mxs{*} cd1-cd32;
>t_cd = cd4bl; /* initially set to baseline */
>
>do i = 1 to dim(mxs);
> if mxs{i} ne . and mxdts{i} ne . and mxdts{i} lt evdt then t_cd = mxs
{i};
>end;
>
>if 0 le t_cd lt 200 then t_cd4cat=1;
> else if 200 le t_cd le 349 then t_cd4cat=2;
> else if 350 le t_cd le 499 then t_cd4cat=3;
> else if 500 le t_cd le 649 then t_cd4cat=4;
> else if t_cd ge 650 then t_cd4cat=5;
>
>run;
Hi Deborah,
Interestingly, we have similar questions:
PHREG with time-varying covariates
http://www.listserv.uga.edu/cgi-bin/wa?A2=ind0812a&L=sas-l&F=&S=&P=44738
I am curious about this line:
> if mxs{i} ne . and mxdts{i} ne . and mxdts{i} lt evdt then t_cd =
mxs{i};
In your MODEL statement:
>model t2dth * dth(0) = gpA t_cd4cat gpA*t_cd4cat / risklimits;
the time seems to be t2dth. As I understand PHREG, and for your safety
assume that I do not understand it correctly, the time of interest is
coming from the MODEL statement.
Also, you *might* be able to omit the baseline assignment statement if
you reconstruct your array to include it as the first value with the
corresponding time of 0?
HTH,
Kevin