Can anyone please tell me what's wrong with the following code which I'm using to call the Macro?
Log doesn't prompt any error but there isn't any external Excel file which is being created.
please help, I'm new!
ODS HTML FILE="/folders/myfolders/sasuser.v94/SP.XLS";
%FINE_CLASS(CSD,INS,11175,21089,AcctAge,10);
ODS HTML CLOSE;
I tried and this is what it prompted
Post your exact full log. That isn't enough information to solve your problem. Often the log has more details and where the errors occur can be indicative of the issues.
Especially if you didn't copy and paste the code correctly or if you had code before the lines shown - in fact I suspect the actual error is before the code shown.
The following are the codes I had pasted before finally calling the macro. Every code worked fine and the error popped up while calling the Macro. Hope this helps!
libname CSD "/folders/myshortcuts/SAS_Assignment";Run;
PROC IMPORT DATAFILE="/folders/myshortcuts/SAS_Assignment/Cross Sell_Data.csv"
OUT=CSD.cross_sell_data
DBMS=CSV
REPLACE;
RUN;
DATA CSD.DEV CSD.VAL;
SET CSD;
IF RANUNI (1000)<= 0.7 THEN OUTPUT CSD.DEV;
ELSE OUTPUT CSD.VAL;
RUN;
PROC SQL;CREATE TABLE L AS SELECT * FROM CSD;
SELECT COUNT (*) FROM L WHERE INS=1;QUIT;
PROC SQL;CREATE TABLE L AS SELECT * FROM CSD;
SELECT COUNT (*) FROM L WHERE INS=0;QUIT;
%MACRO FINE_CLASS (DSN,DEPVAR,TOT_RESP,TOT_NRESP,CLASS_VAR,GRPS);
PROC RANK DATA =&DSN. GROUPS=&GRPS. OUT=BIN_DSN;
VAR &CLASS_VAR.;
RANKS BIN;
RUN;
PROC SQL;
CREATE TABLE FINE_CLASSED AS SELECT
COUNT(*) AS NOBS,
MIN(&CLASS_VAR.) AS MIN_VAL,
MAX(&CLASS_VAR.) AS MAX_VAL,
SUM(CASE WHEN &DEPVAR. = 1 THEN 1 ELSE 0 END) AS RESP,
SUM(CASE WHEN &DEPVAR. = 0 THEN 1 ELSE 0 END) AS NRESP
FROM BIN_DSN
GROUP BY BIN;
QUIT;
DATA FINE_CLASSED1;
SET FINE_CLASSED;
TOT_RESP=&TOT_RESP.;
TOT_NRESP=&TOT_NRESP.;
WOE=LOG(((RESP/TOT_RESP)+0.000000001)/((NRESP/TOT_nRESP)+0.000000001));
IV=((RESP/TOT_RESP)-(NRESP/TOT_NRESP))*WOE*100;
RUN;
PROC PRINT DATA = FINE_CLASSED1;RUN;
/*PROC DELETE DATA = FINE_CLASSED1;*/
/*PROC DELETE DATA = FINE_CLASSED;*/
/*PROC DELETE DATA = BIN_DSN;RUN;*/
%MEND;
ODS HTML FILE="/folders/myfolders/sasuser.v94/SP.XLS";
%FINE_CLASS(CSD,INS,11175,21089,AcctAge,10);
ODS HTML CLOSE;
Hey!
I tried running the code you gave but it didn't work. I had to make a few changes in the code and it's fine now.
Thank You for the help!
@MeghnaRoy9 wrote:
Hey!
I tried running the code you gave but it didn't work. I had to make a few changes in the code and it's fine now.
Thank You for the help!
It wouldn't have solved your problem, it would have put more information to the log to allow you to find the problem more easily.
It is getting to be a worse idea to lie to your computer such as naming a file with an XLS extension when the actual created file is HTML. Excel is getting pretty picky about opening such lies in the latest versions.
If you want spreadsheet output use ODS EXCEL.
But I have used ODS HTML to open Excel files and it has run just fine. It's only in this case that I'm facing a problem so I'm assuming the problem Is with the format of the code.
Can anyone please tell me what's wrong with the following code which I'm using to call the Macro?
Log doesn't prompt any error but there isn't any external Excel file which is being created.
please help, I'm new!
ODS HTML FILE="/folders/myfolders/sasuser.v94/SP.XLS";
%FINE_CLASS(CSD,INS,11175,21089,AcctAge,10);
ODS HTML CLOSE;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.