WARNING: Unsupported device 'ACTIVEX' for EXCEL destination. Using device 'ACTXIMG' - excel

I am getting 'ACTIVEX' warning message in SAS while running below code, I ignored that warning in log when i was running in SAS EG but when i run code through SAS Console (Scheduler) program is failing because of below error.
"ERROR: The width of Status is not between 1 and 132. Adjust the column width or line size."
I had researched in google and as per reference based on that i have added ODS LISTING CLOSE; and ODS LISTING; Still I am facing the same error.
ODS LISTING CLOSE;
%let OUTFILE= \\Bigdata\Vikas\Myquery\REPORT_&RUN_DATE..xlsx;
ODS EXCEL FILE="&OUTFILE" OPTIONS(SHEET_NAME = "REPORT_&REPORTID");
PROC REPORT DATA=WORK.FINAL_OUTPUT
STYLE(HEADER) = {BORDERCOLOR = BLACK FONT_FACE = 'CALIBRI' FONT_SIZE = 9.5PT JUST = CENTER CELLHEIGHT=.30IN BACKGROUND=#EAEAAD FOREGROUND=BLACK}
STYLE(COLUMN) = {BORDERCOLOR = BLACK FONT_FACE = 'CALIBRI' FONT_SIZE = 9.2PT JUST = CENTER CELLHEIGHT=.30IN BACKGROUND=#FFFFFF FOREGROUND=BLACK};
RUN;
ODS EXCEL CLOSE;
ODS LISTING;
I don't want to see ACTIVEX warnings in the log

Add goptions device=actximg; before running your code.

Related

Clikable Hyperlink with SAS ODS EXCEL

I got a problem with Hyperlink generated by SAS ODS EXCEl.
I'm using SAS9.4TM3 and EXCEL 2013.
I coded this
data lst_tie;
NUM_TIE = '2900004227803';
output;
NUM_TIE = '2900004233852';
output;
run;
data lst_tie(drop=HL);
set lst_tie;
format HL2 $500.;
HL = "http://tier-kh.cm-cic.fr/tie6_tiers/default.aspx?trt=tiesyn&banque=02297&caisse=38848&tiers="||NUM_TIE;
HL2 = '=LIEN_HYPERTEXTE("'||HL||'";"'||NUM_TIE||'")';
run;
ods excel file = "$GRPFPU/test_tiesyn.xlsx"
options (absolute_column_width="3cm,20cm,20cm");
proc report data=lst_tie
;
column NUM_TIE
HL2;
define num_tie / "Numero" style(column)={ width=100%};
define HL2 / "Tiers" style(column)={tagattr='wraptext:no' width=100%};
quit;
ods excel close;
The URL seems well encoded :
=LIEN_HYPERTEXTE("http://tier-kh.cm-cic.fr/tie6_tiers/default.aspx?trt=tiesyn&banque=02297&caisse=38848&tiers=2900004227803";"2900004227803")
without carriage return (CR).
But, on opening the XLSX file there is a CR characters just after LIEN_HYPERTEXTE (HYPERLINK in English)
XLSX Preview 1
But if I delete the CR so the hyperlink is OK.
XLSX OK
I tried several option as WIDTH_COLUMS, Wrap Option , but no way.
Thanks
ODS EXCEL is trying to make your printout pretty by inserting physical line breaks into long lines. Apparently it doesn't notice that your value is a formula instead of plain text.
Starting with SAS 9.4M4 you can add flow="tables" to the ODS statement. See this SAS Blog post
ods excel file = "$GRPFPU/test_tiesyn.xlsx"
options (absolute_column_width="3cm,20cm,20cm"
flow="tables"
)
;
For older versions of SAS, like yours, try making the column wider so it doesn't try to wrap it. Try adding width=1000% instead of width=100% to the column with the links.
define HL2 / "Tiers" style(column)={tagattr='wraptext:no' width=1000%};
To have a clickable hyperlink I add a format
``
data lst_tie;
NUM_TIE = '2900004227803';
output;
NUM_TIE = '2900004233852';
output;
run;
data lst_tie;
set lst_tie;
format HL2 $500.;
HL = "http://tier-kh.cm-cic.fr/tie6_tiers/default.aspx?trt=tiesyn&banque=02297&caisse=38848&tiers="||NUM_TIE;
run;
data one;
set lst_tie;
retain fmtname '$urltie';
rename NUM_TIE=start;
label = HL;
run;
proc format cntlin=one;
run;
ods excel file = "$GRPFPU/test_tiesyn.xlsx"
options (absolute_column_width="3cm,20cm,20cm" flow="tables");
proc report data=lst_tie
;
column NUM_TIE
;
define num_tie / "Numero" style(column)={TAGATTR='format:0' width=1.5in url=$urltie. color=cx0000FF textdecoration=underline /*tagattr='wraptext:no' width=100%*/
};
quit;
ods excel close;
``

No visual content after running report in Excel

I am trying to run a Stored Process from the SAS tab in Excel (Reports button). After running it, I get the following message: "Stored Process has completed with no visual content. You can refresh this analysis through the Manage Content dialog box". Below you can see my code:
ods excel;
create table DAI as
select DISTINCT (A.V_NUMBER), B.PHRDEDN_APPLICABLE_GROSS
from UVICRPT.V_HRS_PAYROLL_PHRHIST A, UVICRPT.V_HRS_PAYROLL_PHRDEDN B
WHERE A.PHRHIST_DISP in ('70')
AND A.PHRHIST_PAYNO = &PayNo AND B.PHRDEDN_PAYNO = &PayNo
AND A.PHRHIST_PICT_CODE = "&PictCode" AND B.PHRDEDN_PICT_CODE = "&PictCode"
AND A.PHRHIST_YEAR = B.PHRDEDN_YEAR
AND A.PHRHIST_SEQ_NO = B.PHRDEDN_SEQ_NO;
run;
ods excel options(sheet_interval="table" sheet_name="Koala");
proc print data=DAI style=Table noobs;
run;
ods excel close;
QUIT;
All I want is a new sheet in the book I'm working on named "Koala" with the table displayed.
What am I doing wrong? Any help?

sas ods excel cannot produce multiple worksheet

I'm trying to produce the below two worksheet "woe_con_out" and "woe_cat_out" into the same excel "woe_summary.xlsx". but after running this code, there is only one worksheet is generated (woe_cat_out). Where did I do wrong??
data translate;
format report $256.;
infile "out_con.out" dlm='09'x dsd;
input report $;
run;
ods excel file="woe_summary.xlsx" style = printer options(sheet_name = "woe_con_out") ;
proc print data = translate noobs
style(data) = {font_face = "courier_new" font_size = 11pt}
style(column) = {width = 1000%};
run;
ods excel close;
data translate;
format report $256.;
infile "out_cat.out" dlm='09'x dsd;
input report $;
run;
ods excel file="woe_summary.xlsx" style = printer options(sheet_name = "woe_cat_out") ;
proc print data = translate noobs
style(data) = {font_face = "courier_new" font_size = 11pt}
style(column) = {width = 1000%};
run;
ods excel close;
You need ods excel options statements for EACH proc print statement:
/* first ods excel statement includes the file and style */
ods excel file="C:\desktop\woe_summary.xlsx" style = printer;
/* include ods excel options sheet_name for each PROC PRINT statement */
ods excel options(sheet_name = "woe_con_out");
proc print data = sashelp.class noobs;
var _all_;
run;
/* same as above -- include ods excel options sheet_name for each PROC PRINT statement */
ods excel options(sheet_name = "woe_cat_out");
proc print data = sashelp.fish noobs;
var _all_;
run;
/* close your ods excel engine */
ods excel close;
Also, in your situation, I would create two translate datasets, i.e. translate_con and translate_cat so you don't overwrite them and be able to use the method described.

ODS Excel Macro Overwritten SAS

Here is the code
%macro ODS1 (Type=, var=, data=); ODS listing close;
ODS tagsets.excelXP file = "H:\Liv_Divide\Dispersion1.xml";
proc format;
value myfmt .='#N/A'
other = [11.2];
run;
ODS Tagsets.ExcelXP
options (embedded_titles="Yes" Sheet_Name="&Type");
proc print data = &data (drop = Type) noobs style (header) = [font_style=italic
font_weight=bold
background=#FF9900];
var _all_ / style (data) = [background=White];`
format _numeric_ myfmt.;
format Date MONYY.;
title1 "Measures of Cross-Sectional Dispersion for &var(&Type)";
title2 "Dispersion Measure D1 = 75th Percentile Minus 25th Percentile of the Forecasts for Levels";
run; quit;
ODS Tagsets.ExcelXP close;
ODS listing;
`%mend ODS1;`
`%ODS1 (type=RGDPX, data=Dispersion1_RGDPX, var=REAL GROSS DOMESTIC PRODUCT);
%ODS1 (type=GDPX, data=Dispersion1_GDPX, var=GROSS DOMESTIC PRODUCT);
%ODS1 (type=BFIX, data=Dispersion1_BFIX, VAR=BUSINESS FIXED INVESTMENT);
%ODS1 (type=CPAT, data=Dispersion1_CPAT, VAR=CORPORATE PROFITS AFTER TAX);
%ODS1 (type=IP, data=Dispersion1_IP, VAR=INDUSTRIAL PRODUCTION);
%ODS1 (type=TPHS, data=Dispersion1_TPHS, VAR=TOTAL PRIVATE HOUSING);
%ODS1 (type=PPI, data=Dispersion1_PPI, VAR=PRODUCER PRICE INDEX);
%ODS1 (type=CPI, data=Dispersion1_CPI, VAR=CONSUMER PRICE INDEX);
%ODS1 (type=UNPR, data=Dispersion1_UNPR, VAR=UNEMPLOYMENT RATE);
%ODS1 (type=WMFG, data=Dispersion1_WMFG, VAR=WEEKLY EARNINGS);
%ODS1 (type=RTTR, data=Dispersion1_RTTR, VAR=RETAIL SALES);
%ODS1 (type=AUTODF, data=Dispersion1_AUTODF, VAR=AUTOSALES);
%ODS1 (type=PRIME, data=Dispersion1_PRIMEK, VAR=PRIME RATE);
%ODS1 (type=TBOND, data=Dispersion1_TBOND, VAR=TBOND RATE);
%ODS1 (type=TBILL, data=Dispersion1_TBILL, VAR=TBILL RATE);
%ODS1 (type=SPIF, data=Dispersion1_SPIF, VAR=STANDARD & POORS);`
The problem is when I run the code, instead of producing separate sheets for each type, the data is overwritten in a way that I only get the Excel file with one worksheet for the very last Type (i.e. SPIF). So I end up with only one sheet. Is there anyway that when I run the Macro, that it will produce a separate sheet for each type without overwriting one sheet with another when I call the macro for each type.
you need to move the ODS tagsets.excelXP file = and ODS Tagsets.ExcelXP close; statements outside of the macro. You are overwriting the file each time.
Here is a simplified version of your code that works:
%macro ODS1 (Type=, var=, data=); ODS listing close;
ODS Tagsets.ExcelXP
options (embedded_titles="Yes" Sheet_Name="&type");
proc print data = &data(obs=10) noobs;
run;
run; quit;
%mend ODS1;
ODS tagsets.excelXP file = "c:\temp\Dispersion1.xml";
%ods1(type=cars,data=sashelp.cars);
%ods1(type=shoes,data=sashelp.shoes);
ODS Tagsets.ExcelXP close;
ODS listing;

SAS: export multiple procedures output to Excel using ODS

I am running bunch of tobit models on SAS. I want to transfer the output to Excel, but I want the output from all models to be in one Excel book (as opposed to creating one book for each model.) How would one do that? Many thanks.
I have the following code, but it only reports on of the results
ODS TAGSETS.EXCELXP
file='C:\Documents and Settings\Administrator\My Documents\...\Results.xls'
STYLE=minimal
OPTIONS ( Orientation = 'landscape'
FitToPage = 'yes'
Pages_FitWidth = '1'
Pages_FitHeight = '100' );
Proc qlim Data=AD.Data;
class var1;
model don =var1 var2;
endogenous don ~ truncated (lb = 1);
Run;
Proc qlim Data=AD.Data;
class var1;
model don =var1 var2 var1*var2;
endogenous don ~ truncated (lb = 1);
Run;
quit;
ods tagsets.excelxp close;
The ODS statement controls where output is written. To begin writing to a new "worksheet", use a new ODS statement with a different sheet_name.
Here is a simple example:
ods tagsets.ExcelXP file="SASHELP.CARS Analysis.xls"
path="c:\temp" style=minimal;
ods tagsets.ExcelXP options(sheet_name="RawData" embedded_titles='Yes');
title "SASHELP.CARS Listing";
proc print data=SASHELP.CARS noobs;
run;
ods tagsets.ExcelXP options(sheet_name="MakeFreq" embedded_titles='Yes');
title "SASHELP.CARS Stats";
proc freq data=SASHELP.CARS;
table make;
run;
ods tagsets.ExcelXP close;
Note the first ODS statement just defines the workbook destination and style. A separate ODS statement is used to define each work sheet.

Resources