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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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