BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
haoduonge
Quartz | Level 8

Hi all,

I run the code below, and although I can see the results in the SAS window, the Excel file that I saved is not visible. I would appreciate it if you could review the code and provide guidance on how to fix this issue. 

Thank you!

 

libname out xlsx "C:\1.PROJECTS\XXX\test_snp.xlsx";
%macro HR(x=);
%let outputName=_PE%substr(%cmpres(&x.),1,%sysfunc(min(%length(&x.),29)));
ods graphics off;
ods output ParameterEstimates=&outputName.;
*;
proc phreg data = all;
CLASS &x (ref='0');
model FU_TIME_YRS *HCC_DEAD(0)=&x /eventcode=1;
run;
*;
ods output close;
ods graphics on;
*;
%mend HR;
*;
%HR(x=GEN1);
%HR(x=GEN2);

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Your code does not use the Library you defined that I can see.

I'm not fond of library names like OUT  as they are easy to confuse with options but I think this may have been what you intended, since you don't really state what is supposed to appear in Excel. To send output to a library the reference is always libname.datasetname (or catalog or other SAS item)

 

%macro HR(x=);
%let outputName=_PE%substr(%cmpres(&x.),1,%sysfunc(min(%length(&x.),29)));
ods graphics off;
ods output ParameterEstimates= out.&outputName.;
*;
proc phreg data = all;
CLASS &x (ref='0');
model FU_TIME_YRS *HCC_DEAD(0)=&x /eventcode=1;
run;
*;
ods output close;
ods graphics on;
*;
%mend HR; 

 

View solution in original post

2 REPLIES 2
ballardw
Super User

Your code does not use the Library you defined that I can see.

I'm not fond of library names like OUT  as they are easy to confuse with options but I think this may have been what you intended, since you don't really state what is supposed to appear in Excel. To send output to a library the reference is always libname.datasetname (or catalog or other SAS item)

 

%macro HR(x=);
%let outputName=_PE%substr(%cmpres(&x.),1,%sysfunc(min(%length(&x.),29)));
ods graphics off;
ods output ParameterEstimates= out.&outputName.;
*;
proc phreg data = all;
CLASS &x (ref='0');
model FU_TIME_YRS *HCC_DEAD(0)=&x /eventcode=1;
run;
*;
ods output close;
ods graphics on;
*;
%mend HR; 

 

haoduonge
Quartz | Level 8
Thank you!

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1230 views
  • 1 like
  • 2 in conversation
OSZAR »