SAS and Bing Maps API

Here is a method for using SAS and Bing Maps:

Signed up for a key on Bing Maps API. Create a basic key and copy it somewhere. I will demonstrate it in the SAS code as [BINGKEY] since I cannot share mine publicly:
Use the following code: %let z1=47.64054;
%let z2=-122.12934;

filename x url ",&z2.?o=xml&BINGKEY";
filename z "c:\temp\BingMap.xml";

data _null_;
infile x ;
file z ;
put _INFILE_;

Parse the xml that is produced as needed. You can also output it as JSON if you change the word xml in the URL to json.

SAS EG Add-Ins and WPF

Well, I finally made progress on getting my dynamic WPF add-in working. This was in large part to Chris Hemedinger helping out with some questions. What I have learned, I want to share so it is not lost.

WPF works fine with EG except for some graphics issues found when the form is displayed in EG. Not a major issue, a minor one.

The main thing is that it works, runs dynamically using web services on the backend, uses MEF (very cool Framework), and saves us a lot of effort.

Here are some of Chris' suggestions.

How to debug
To be effective at debugging, you need a professional version of Visual Studio.  The Express editions don't allow you to debug an application unless you built that app (the EXE) with Express.  

Assuming that you have the a Pro version, you can use this approach:
-Copy the DLL and PDB (symbols) file into the directory where you are putting Custom tasks.
-Start EG as normal, see the custom task in the Add-Ins menu.
-Before you launch the task, use Visual Studio to …

SAS EG "add-in is an invalid file type"

I am working on a SAS EG Add-In right now. As part of it, I encountered this error:

"add-in is an invalid file type"

Ok. Great. How do I solve it?

For my project, it turned into a missing dll. Simple? Yes, but it took hours to track down. Hopefully this post helps out the next person.

Chris H. suggested the following means of finding the cause of an error:

SOAP Error on Encoding

If you are trying to get a web service operational and encounter errors similar to the following:

SOAPUI error:
The message could not be processed. This is most likely because the action '' is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint's binding.

SAS error:
ERROR: Cannot process the message because the content type 'text/xml;
charset=UTF-8' was not the expected type 'application/soap+xml; charset=utf-8'. [415]
WCF Error: The caller was not authenticated by the service. Make sure you use basicHttpBinding vs wsHttpBinding in your web.config if using WCF (which I am…

SAS Deployment Manager and Meadow Muffins

Ok, so I am deep in the depths of the SAS Deployment Manager and am learning things the hard way (and spending time curled into a fetal position).

Ok, let's start with uninstall because it is this morning's pain point.

When creating a quiet uninstall, here is the command I was using:

"C:\Program Files\SAS 9.3.0 (SAS BI Solutions)\SASDeploymentManager\9.3\sasdm.exe" -uninstall -record -responsefile "c:\temp\uninstall2.txt"

I have highlighted in yellow my mistake. By including the -uninstall, the resulting responsefile was missing a critical component:


Why SAS does not ignore it, I am unsure of. How do you know it fails? Well, you don't easily. It seems to run, then just goes back to a command prompt. The sas.mif file will show a failure if you go and look at it:

cd %TEMP%
type sas.mif

Watch this issue on the install as well. Per the SAS documentation:

If you use any other command line options while using record, those options are not incl…

SAS XPT Files, IBM Floats, and C#

Well, I recently was asked if I could support XPT files, you know, the SAS transport format. Well, SAS transport formats are documented and fairly straight-forward to read so 'why not?'.

Got started coding, client provided a nice sample, all went well. Around 8-10 hours after starting, I was happily reading SAS transport files and writing them to a tab-delimited file.

However, things weren't happy on Big Rock Candy Mountain.Seems the numbers were off. A little bit of reading in the SAS XPORT Documentation indicated the problem:

"All floating-point numbers in the file are stored using the IBM mainframe representation. If
your application is to read from or write to transport files, it will be necessary to
convert native floating-point numbers to or from the transport representation."

Not a problem. Let's go track down a C# library that handles IBM 370 floats and does the conversion. One small problem...I couldn't find one. What I did find was that this was…