BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
TomHsiung
Pyrite | Level 9
/*Cox Regression*/
%let class_var = genderC;
%let length = timeToFirstInrAttain;
%let response_var = firstInrAttain;
%let indep_list = ageY genderC BSA AF Hypertension CHF serumAlb akiC ddiC indicationC CYP2C9code VKORC1Code;

%macro Cox;
proc phreg data = &raw_data_name;
class &class_var;
model &length*&response_var(1) = &indep_list;
run;
%mend;

The &indep_list was read by the PROC PHREG as the very &indep_list, instead of the 12 vars it represented. I compared this with PROC LOGISTIC and the later PROC does not have this issue.

1 ACCEPTED SOLUTION

Accepted Solutions
TomHsiung
Pyrite | Level 9
Hi, Quentin
Thanks for you comments. Well, today I re-ran the code and it did not reproduce the issue. Therefore, I am not able to reproduce the error log. I use SAS University edition and my networking connection was bad yesterday. Maybe the networking lag caused this issue. Thank you.

View solution in original post

4 REPLIES 4
Quentin
Super User

This is not possible, because the macro variable resolution happens before PROC PHREG has started to execute.

 

Can you post the full log from running an example, with system option MPRINT turned on?

 

 

 

 

The Boston Area SAS Users Group is hosting free webinars!
Next webinar will be in January 2025. Until then, check out our archives: https://www.basug.org/videos. And be sure to subscribe to our our email list.
TomHsiung
Pyrite | Level 9
Hi, Quentin
Thanks for you comments. Well, today I re-ran the code and it did not reproduce the issue. Therefore, I am not able to reproduce the error log. I use SAS University edition and my networking connection was bad yesterday. Maybe the networking lag caused this issue. Thank you.
ballardw
Super User

Any time you are working with macros, not just macro variables but actual %macro/%mend code and something goes wonky there are 3 basic things to do:

1) make sure have saved the code files and data

2) close the SAS session (if you can watch the LOG screen while doing this you might see error messages just as the session shuts down)

3) restart a new SAS session.

 

The macro language has lots of places that very little things can end up with the code you think you submit is not what is actually seen by the processor. Some of these can be subtle, others result in no apparent code running at all. Resetting the session clears out some of that.

When you say that re-running the code today didn't do that I suspect it was in a new SAS session correct?

TomHsiung
Pyrite | Level 9

Thanks for these advice, ballardw.

 

Yep, I will follow your guide.

SAS Innovate 2025: 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
  • 4 replies
  • 721 views
  • 2 likes
  • 3 in conversation