Thursday, September 28, 2017

SAS: Exporting XML to Excel, missing ApnDatabase.xml file




I got an error message "ApnDatabase.xml not found". It has something to do with exporting XML to XLS. Turns out my ApnDatabase.xml did, in fact, exist in C:\Windows\System32. After much headbanging I found an obscure note on the web that said if you are using Windows 10 then ApnDatabae.xml needs to be in C:\Windows\SysWOW64. I copied the file from System32 to SysWOW64 and restarted my machine and it worked.



Tuesday, September 26, 2017

SAS: ERROR: Insufficient authorization to access C:\Windows\system32\sasgraph.jpg






Re: ERROR: Insufficient authorization to access C:\Windows\system32\sasgraph.jpg




Hello Bill,

This is in regard to SAS tracking number 7612237223, where in your last email to this track, you wrote:

>At this point I really don’t care how or where the graph is created: I just want the code (which I inherited) to run. If you look at the source, it’s clear that the code is generated from an EG wizard. And yet it has this error. I see this error throughout this particular EG project. Have Googled it. This helped in SOME cases, but not this one.

If you are submitting actual code to SAS via Enterprise Guide, modify the following statements in the code:

ODS _ALL_ CLOSE;
GOPTIONS RESET=ALL;
OPTIONS DEV=PNG;
GOPTIONS XPIXELS=0 YPIXELS=0;
GOPTIONS ACCESSIBLE;
ODS OUTPUT;
ODS GRAPHICS ON;
ODS LISTING GPATH="%sysfunc(getoption(WORK))";

So that they now look like this:

ODS _ALL_ CLOSE;
ODS LISTING;

FILENAME GRAFOUT  "%sysfunc(pathname(work))/sasreport.png";

GOPTIONS RESET=ALL DEVICE=PNG GSFNAME=GRAFOUT;


As you can see, Enterprise Guide adds a lot of extra statements to the code that are not actually needed.  The statements above will allow the code to run fine and will write the PNG graph file to the temporary SAS WORK location.  Instead, if you prefer to right the graph to a permanent directory on your hard drive, replace  %sysfunc(pathname(work))  above with an actual existing directory on your hard drive, such as:

FILENAME GRAFOUT  "C:/Temp/sasreport.png";

Regards,


SAS Technical Support
http://www.sas.com
http://support.sas.com

SAS ... THE POWER TO KNOW







Monday, September 11, 2017

SAS: Write value of a macro variable to log

Whenever I need to write the value of a macro variable to the SAS log, I do the following

%put MACVAL=&MACVAL;

Well, according to http://support.sas.com/documentation/cdl/en/mcrolref/69726/HTML/default/viewer.htm#n189qvy83pmkt6n1bq2mmwtyb4oe.htm, the same thing can be done as follows:

%put &=MACVAL;