BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
dawidkaz
Calcite | Level 5

Hello,

my phrege procedure seams to not work corectly  since I want to include in a model all nunmeric variables from the data set while the censoring variable is also numeric.

I got the warning:

The censoring variable rc is also an explanatory variable.

 

ods graphics on;
proc phreg data=model_cox alpha=0.05 namelen=32;
class &zm_class. / order=freq ref=first;
model ttd * rc(0,1) = _NUMERIC_ / ties = breslow rl=wald selection=stepwise /*slentry=0.25
slstay=0.15*/;
ods graphics off;

 

Is there a easy way to pick all numeric variables exept for rc?

 

Thank you 

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Might just be easiest to put the list into a macro variable.

proc contents data=model_cox  noprint out=contents; run;
proc sql noprint;
select name into :names separated by ' '
  from contents
  where type=1 and upcase(name) ne 'RC' 
;
quit;

proc phreg data=model_cox alpha=0.05 namelen=32;
  class &zm_class. / order=freq ref=first;
  model ttd * rc(0,1) = &names 
      / ties = breslow rl=wald selection=stepwise 
          /* slentry=0.25 slstay=0.15 */
;
run;
quit;

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

Might just be easiest to put the list into a macro variable.

proc contents data=model_cox  noprint out=contents; run;
proc sql noprint;
select name into :names separated by ' '
  from contents
  where type=1 and upcase(name) ne 'RC' 
;
quit;

proc phreg data=model_cox alpha=0.05 namelen=32;
  class &zm_class. / order=freq ref=first;
  model ttd * rc(0,1) = &names 
      / ties = breslow rl=wald selection=stepwise 
          /* slentry=0.25 slstay=0.15 */
;
run;
quit;
Reeza
Super User

Here is a reference that illustrates how to refer to variables and datasets in a short cut list:
https://blogs.sas.com/content/iml/2018/05/29/6-easy-ways-to-specify-a-list-of-variables-in-sas.html

 

Depending on where in the data set the variable is located, this may be an option:

 

firstVar-numeric-lastVar;

@dawidkaz wrote:

Hello,

my phrege procedure seams to not work corectly  since I want to include in a model all nunmeric variables from the data set while the censoring variable is also numeric.

I got the warning:

The censoring variable rc is also an explanatory variable.

 

ods graphics on;
proc phreg data=model_cox alpha=0.05 namelen=32;
class &zm_class. / order=freq ref=first;
model ttd * rc(0,1) = _NUMERIC_ / ties = breslow rl=wald selection=stepwise /*slentry=0.25
slstay=0.15*/;
ods graphics off;

 

Is there a easy way to pick all numeric variables exept for rc?

 

Thank you 


 

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 594 views
  • 1 like
  • 3 in conversation