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
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;
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;
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
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.
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.
Ready to level-up your skills? Choose your own adventure.