- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
/*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.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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?
Next up: Rick Wicklin presents Ten Tips for Effective Statistical Graphics (with SAS code) on Wednesday March 26.
Register now at https://www.basug.org/events.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for these advice, ballardw.
Yep, I will follow your guide.