Use MongoDB as a JSON factory MongoDB is a persistent data store for JSON formatted data, which seems like an ideal middleware between the data tier software and the web. With MongoDB, Javascript's Map/Reduce functionality makes many trivial jobs particularly easy, such as translate an object to an array. For example, we can produce a bubble plot with Highcharts.js and the SASHEP.IRIS dataset in SAS very quickly.Step 1: push SAS dataset toward MongoDBFirst, let's push the SASHEP.IRIS dataset from SAS to MongoDB using thesas2mongo macro.%sas2mongo(data = sashelp.iris, dbname = demo, collname = iris, tmpfolder = c:\tmp, mongofolder =c:\mongodb\bin);Step 2: make the JSON fileUnder the MongoDB shell, we could use Javascript'smap function to transform data ...
A SAS macro that exports data to MongoDB MongoDB is possibly the most popular NoSQL data store. To bypass schema and constraint, I feel quite convenient to implement MongoDB as buffer to accompany current RDBMS .Also it is straightforward to use MongoDB and other tools (MEAN) to build some simple web apps for statistics presentation.Neither SAS nor 10gen so far published any SAS-MongoDB driver. However, the table-like dataset in SAS can be transformed to CSV by PROC EXPORT or DATA Step. MongoDB has a nice API mongoimport that easily accepts CSV formatted data. I write a macro in SAS below to transport data from SAS to MongoDB. The speed is quite fast.****************(1) MODULE-BUILDING ...
Play Basel II Accord with SAS (1): capital requirement Basel II Accord, revised by Basel Committee on Banking Supervision (BCBS) and adopted by more than 100 nations, regulates the commercial banks’ capital against risks. Major US banks are under the transition window to fully comply it (2008-2011) [Ref. 1]. I am especially interested in exploring Basel II by SAS codes.Basel II Accord provides the detailed requirements by its three ‘pillars’. Pillar 1 is about the minimal capital requirement and tries to hold the total capital at 8% of risk-weighted assets. Paragraph 272 gives the equations to calculate the capital requirement for a loan with its risk factors, such as ...
Bubble plot by SAS and Highcharts.js Bubble plot is a nice data visualization choice for three dimensional numeric variables. It seems quite popular on web and documents. Static plotting by SASSince SAS 9.3, PROC SGPLOT provides a bubble statement, which makes a bubble plot easy. For example, the dataset SASHELP.CLASS can be quickly projected onto a bubble plot.proc sgplot data = sashelp.class; title 'bubble plot by sashelp.class'; bubble x = weight y = height size = age / group = sex transparency = 0.5; yaxis grid;run;Dynamic plotting by SAS and Highcharts.jsFor the show-off on web, an interactive bubble plot above will be much more attractive. First we ...
Cluster analysis on a pivot table The link of the pivot table is hereThe increasing supremacy of JavaScript on both server side and client side seems a good news for those statistical workers who deal with data and model, and therefore always live in the darkness. They could eventually find a relatively easier way to show off their hard work on Web, the final destination of data. Here I show how to display the result of a cluster analysis on a web-based pivot table.Back-end: cluster analysisSAS has a FASTCLUS procedure, which implements a nearest centroid sorting algorithm and is similar to k-means. It has some time and space advantages ...