PHREG baseline survival estimates.

Reply
Super Contributor
Posts: 297

PHREG baseline survival estimates.

%let pt=pt;

%macro pat(patt=);

%do &pt=1 %to &patt;  /*** I NEED THE BASELINE COVARIATE FOR AGE=0, So for each data below new_1, new_2, I want the first to set the covariates=Pattern_1, covariates=Pattern_2*/

data Pattern_&pt;

age=0;

output;

run;

%end;

%mend pat;

%MACRO DO_BRANCH(replicates=);

%do u=1 %to &replicates;

proc surveyselect data=new  method = urs sampsize = 141 OUTHITS

     reps=1 seed=1234100 out=new_&u;

run;

%pat(patt=2);

ods trace on /listing;

ods graphics on;

ods output ParameterEstimates=CPHH_&u;

proc phreg data=new_&u ;

model monset*obs(0)=age;

*baseline out=survs survival= survival;

baseline covariates=Pattern_&pt out=survs_&u survival= survival;  /* THe issue is that SAS doesnot seem to understand that I want covariates=pattern_1 when running the data set new_1 and covariates=pattern_2 for new_2*/

run;

ods trace off;

%end;

%MEND DO_BRANCH;

%DO_BRANCH(repli

cates=2);

Super User
Posts: 17,831

Re: PHREG baseline survival estimates.

Try commenting the above code, every line, with what you expect and repost. 

Pay attention to where your macro variables are, a macro variable inside a macro is a local macro variable and does not exist outside the macro (for example &pt). You have two macro variables, &pt and &u, are each where you expect them to be?

Super Contributor
Posts: 297

Re: PHREG baseline survival estimates.

Thanks .This is what I have:

%macro pat(patt=);

%do pt=1 %to &patt;

data Pattern_&pt;

age=0;

output;

run;

%end;

%mend pat;

%MACRO DO_BRANCH(replicates=);

%do u=1 %to &replicates;

proc surveyselect data=new  method = urs sampsize = 141 OUTHITS

     reps=1 seed=1234100 out=new_&u;

run;

%pat(patt=2);

ods trace on /listing;

ods graphics on;

ods output ParameterEstimates=CPHH_&u;

proc phreg data=new_&u ;

model monset*obs(0)=age;

*baseline out=survs survival= survival;

baseline covariates=Pattern_&pt out=survs_&u survival= survival;

run;

CODES>>>>>>>

%end;

%MEND DO_BRANCH;

This does not work

%DO_BRANCH(replicates=2);

Super User
Posts: 17,831

Re: PHREG baseline survival estimates.

You're stilling mixing up your macro variables.  &pt and &u.

Super Contributor
Posts: 297

Re: PHREG baseline survival estimates.

I do not know how I am mixing them up both are 2. Can you help show me how to correct it so that I do not mix them up

Super User
Posts: 17,831

Re: PHREG baseline survival estimates.

But, do they both exist? And are you using &pt when you should be using &u? And where is &u defined or assigned.

Super Contributor
Posts: 297

Re: PHREG baseline survival estimates.

I have commented the code place it back, can anyone help

Ask a Question
Discussion stats
  • 6 replies
  • 272 views
  • 0 likes
  • 2 in conversation