The macro generates Sudoku puzzles using a two-stage algorithm. Initially it finds a completed Sudoku square using a Markov chain algorithm that tries to sample at random from all squares that exist. The macro is not restricted to 9x9 squares and can generate squares up to 25x25 within a reasonable amount of time. In the field of experimental design, these squares are known as gerechte designs with rectangular regions. The second stage algorithm uses very simple reverse solving logic to generate a valid puzzle, by removing clues one by one from the completed square. The puzzle generated is written to a SAS data set in the work library and can also be viewed as listing output or as RTF/PDF files.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.