Here is a SAS program to help you beat others at Sudoko, and impress people. It was written by a chap named Ryan Howard in 2006, and I am thankful for him in allowing me in sharing this.You can let us know if you find a puzzle it could not solve , or if you tweak the program a bit. The code is pasted below.
Have fun !

And the SAS paper on this was at SAS Global Forum 2007- the resulting
paper, “SAS and Sudoku”, was written by Richard DeVenezia, John Gerlach,
Larry Hoyle, Talbot Katz and Rick Langston, and can be viewed at
http://www2.sas.com/proceedings/forum2007/011-2007.pdf.
(p.s. I haven’t tested this on WPS , they still dont have the SAS Macro language ,but let me know if you have any equivalent in SPSS or R 🙂  )
*=============================================================================;
* sudoku.sas ;
* Written by: Ryan Howard ;
* Date: Sept. 2006 ;
*-----------------------------------------------------------------------------;
* Summary: This program solves sudoku puzzles consisting of a 9X9 matrix. ;
*-----------------------------------------------------------------------------;
* Upgrade Ideas: 1. Add a GUI to collect the input numbers and display output;
* 2. Expand logic to work for 16X16 matrices ;
*=============================================================================;
title;
options nodate nonumber;
data _null_;
*-----------------------------------------------------------------------------;
* input inital values for each cell from puzzle ;
*-----------------------------------------------------------------------------;
_1111=9; _1112=.; _1113=.; _1211=.; _1212=.; _1213=.; _1311=1; _1312=.; _1313=.;
_1121=5; _1122=.; _1123=.; _1221=.; _1222=6; _1223=.; _1321=.; _1322=4; _1323=2;
_1131=.; _1132=.; _1133=.; _1231=7; _1232=1; _1233=.; _1331=5; _1332=.; _1333=.;
_2111=.; _2112=.; _2113=2; _2211=.; _2212=.; _2213=.; _2311=.; _2312=1; _2313=.;
_2121=.; _2122=3; _2123=.; _2221=.; _2222=.; _2223=.; _2321=2; _2322=9; _2323=.;
_2131=.; _2132=7; _2133=.; _2231=.; _2232=.; _2233=6; _2331=.; _2332=.; _2333=3;
_3111=.; _3112=2; _3113=.; _3211=.; _3212=.; _3213=8; _3311=.; _3312=.; _3313=.;
_3121=.; _3122=.; _3123=4; _3221=5; _3222=.; _3223=.; _3321=.; _3322=.; _3323=.;
_3131=.; _3132=.; _3133=.; _3231=.; _3232=3; _3233=.; _3331=8; _3332=.; _3333=9;
%macro printmatrix;
*----------------------------------------------------------------;
* print the result matrix ;
*----------------------------------------------------------------;
*---------------------------------------------------;
* Assign column positions for printing matrix ;
*---------------------------------------------------;
c1=1;
c2=10;
c3=20;
Continue reading "SAS Fun: Sudoko"


