(DS2 would be the king!) Years ago I made up a piece of SAS code to demonstrate the basic idea of Map-Reduce. Now this idea can be best implemented by this piece of workable program with PROC DS2 (tested in SAS 9.4 TS1M2, Win7): PROC DS2; /* create some data –*/ data input_data /...

Read more »

Tags: DS2, MapReduce, SAS

Posted in SAS | Comments Off on SAS MapReduce: A Quick Followup by DS2

The code: data a; input i a $ b $; datalines; 1 a1A b1 1 a1A b1 2 a2 b2 ; run; data b; input i a $ c $; datalines; 1 a1C c1 2 . c2 3 . c3 ; run;...

Read more »

Tags: DS2, merge, SAS

Posted in SAS | Comments Off on A Quick Look at SAS DS2 Merge

1. Permutation and Combination data _null_; n = 5; r = 2; *the factorial of a number; fact=fact(n); *for positive integers, fact(n) = gamma(n+1); gamm=gamma(n + 1); *C(n,r): number of combinations of n objects selected r ; *n! / ; comb1 = comb(n,r); comb2...

Read more »

Tags: combination, IML, SAS

Posted in SAS | Comments Off on SAS Combinatorial Functions: Snippets

This quick note serves as a supplementnote of my previous Statistical Notes (3): Confidence Intervals for Binomial Proportion Using SAS which I will extend as a SESUG 2015 paper. Basically I added a new Blaker method to my CI_Single_Proportion.sas file and found more CIs from SAS PROC FREQ. First of all, call the script:...

Read more »

Tags: Confidence Interval, SAS, Statistics

Posted in SAS | Comments Off on Statistical Notes (3B): Confidence Intervals for Binomial Proportion Using SAS, Updated

It was very disappointed that there is only one built-in method to calculate covariance in Base SAS: that’s in PROC CORR (while you can also do it in SAS/IML, of course): The following is a quick-and-dirty way to get a function like %COV: %macro COV(data, var1,var2); %local _cov; %let rc = %sysfunc(dosubl(%str( ods...

Read more »

Tags: SAS, Statistics

Posted in SAS | Comments Off on Calculating Covariance by SAS, A Brutal Way

I didn’t play with SAS/IML for a while. I call it back when I need to read some R format data. Technically, .Rdata is not a data format. It’s rather a big container to hold bunch of R objects: In this example, when a .Rdata is loaded, 3 objects are included where ‘data’(the ‘real’...

Read more »

Tags: format, R, SAS

Posted in SAS | Comments Off on Import .Rdata to SAS, along with Labels

In Lex’s library of the latest SAS Global Forum 2015 papers, I found an interesting paper by Wu Gong, Jeffreys Interval for One-Sample Proportion with SAS/STAT Software, where SAS MCMC procedure and a so called Random Walk Metropolis Algorithm were implemented to calculate the Jeffreys interval for binomial proportion. Years ago I wrote several...

Read more »

Tags: Confidence Interval, SAS, Statistics

Posted in SAS | Comments Off on Confidence Intervals for Binomial Proportion (Again): A Quick Note

Typically, SAS list manipulations needs bunch of SAS I/O functions which are not necessarily well known to all SAS programmers. The new DOSUBL function makes this technique much more easier and little bit of ugly I must admit: %MACRO ExpandVarList(data=_LAST_, var=_ALL_); %if %upcase(%superq(data)) = _LAST_ %then %let data = &SYSLAST; %let...

Read more »

Tags: SAS

Posted in SAS | Comments Off on List Manipulations Made Easy (and little bit of UGLY): the New DOSUBL Function