SAS ODS. Set rute for export - sas

Currently I'm trying to export a Graph with ODS in a SAS guide enviroment. The problem is that we try to export the file on a rute, SAS introduces on the rute the pre-name /sas/config1/Lev1/SASApp/. Anyone knows if it is possible to change this?.
ERROR: Pysical file does not exist, /sas/config1/Lev1/SASApp/....
ods listing close;
ods msoffice2k path="...............";
file='example.xls';
Proc gchar data=WORK.EXAMPLE;
....
...
....
run;
QUIT;
ODS msoffice2k close;
ods listing;
Thanks before-hand for the help,
Antonio Castillo

Related

ods excel and proc template

I am running into an error when trying to use ods excel after defining a style named excel via ods template. I was wondering if anyone could explain why this is happening as I thought ods styles and ods destinations were two completely separate things.
The following ods excel statement works fine:
ods excel file="%sysfunc(pathname(work))\x.xlsx";
proc print data=sashelp.class;
run;
ods excel close;
But if I try to run it after running the below proc template code, I get an error.
proc template;
define style excel;
parent=styles.htmlblue;
class graph / attrpriority='none';
style graphdata1 / contrastColor=#416FA6 markersymbol='circlefilled';
style body from body / pagebreakhtml=_undef_; * REMOVE THE HORIZONTAL RULE;
end;
run;
ods excel file="%sysfunc(pathname(work))\x.xlsx";
proc print data=sashelp.class;
run;
ods excel close;
The error is:
ERROR: Could not find method.
ERROR: No body file. EXCEL output will not be created.
I can just rename my style to something other than excel to fix the issue, but I don't understand why this is happening in the first place. Is anyone able to explain? Thanks.
From comments, thanks #Tom:
Use ods styles.excel instead of ods excel:
ods styles.excel file="%sysfunc(pathname(work))/x.xlsx";
proc print data=sashelp.class;
run;
ods styles.excel close;

SAS ODS output formatted weird

I'm trying to export a content to Excel. I use the below code but my output excel formatting is horrible.
ods excel file= "&cur_path/&project_name._Proc_Means.xlsx" style=printer ;
proc means data=&this_lib..&this_data;
run;
ods excel close;
The output looks like
The huge blank gap makes the file unreadable. I also find out that it puts all the outputs in the same row instead of many different rows.
Any suggestions on how to fix it?
Thanks in advance.
Assuming you have SAS 9.3+, which you must to use ODS EXCEL, you can add the stackodsoutput option to the PROC MEANS statement; that will give you a much more nicely formatted sheet.
ods excel file= "c:\temp\Proc_Means.xlsx" style=printer ;
proc means data=sashelp.cars stackodsoutput;
run;
ods excel close;
If you have prior to 9.3, you may want to use the OUT= option in PROC MEANS and then output the dataset yourself using PROC EXPORT or PROC PRINT. The default PROC MEANS ODS output is not very table-friendly.

How to have multiple graphs generated by one gplot procedure output to a single PDF file?

The following GPLOT procedure generates many graphs(It gives sales by different product). Say if my product has 'Sofa', 'bed', 'Chairs', it will give 3 graphs, one for sofa, one for chairs, one for bed.
I'd like to have all the three graphs generated to be output to one single PDF file. I tried the following, but it only keep the last graph generated. Any ideas how I can do this?
ODS PDF FILE= 'OUTPUT.PDF';
PROC GPLOT data = AB.TEMP;
plot sales*Months=Product;
by Region;
run;
ODS PDF CLOSE;
Thanks!
Sandwich your code between ODS PDF and ODS PDF CLOSE statements.
ODS PDF FILE='my_file.pdf' style=meadow;
PROC GPLOT data = AB.TEMP;
plot sales*Months=Product;
by Region;
run;
ODS PDF CLOSE;
Does this work for you? If so, then you have something wrong in your code. Post your code and log in that case.
proc sort data=sashelp.cars out=cars;
by origin;
run;
ods pdf file="C:\_localdata\temp.pdf" style=meadow;
proc gplot data=cars;
plot mpg_city*msrp=make;
by origin;
run;
ods pdf close;

SAS 9.3 goptions ignores gsfname

Sorry for my bad english :)
I need to export gif picture from SAS proc gchart:
filename graphout "&PATH.\file.gif";
goptions gsfname=graphout dev=gif gsfmode=replace;
proc gchart data=work.temp;
/*forming chart*/
run;
quit;
filename graphout clear;
But export occurs in the work directory. What's the problem?
I can't figure out what the problem is with the option, but I recommend not using that to create your graphics in any event. ODS is much easier to use. There are a lot of ways to do this in ODS; the HTML destination is usually the easiest:
ods html gpath="c:\temp\" path="c:\temp\";
proc gchart data=sashelp.class;
vbar age/group=sex name="mychart";
run;
quit;
I faced same problem with you. After I tried to put
ods listing;
before your code, it works.

Output values to excel in sas

Can some one please help me to output the data generated from the following code(yt) to an excel data set?
proc iml;
d = 0.4;
call farmasim(yt, d) n=10 sigma=2 seed=123457;
print yt;
run;
ods tagsets.excelxp file="myfile.xml";
proc iml ... etc. ... quit;
ods tagsets.excelxp close;
For more info google "tagsets.excelxp" or see http://support.sas.com/rnd/base/ods/odsmarkup/excelxp_demo.html
Alternately, you can move yt into a dataset, and use PROC EXPORT, either to EXCEL if you have ACCESS to PC FILES licensed, or to CSV if not.