/***************************************************************************************************************** SAS file name: proc_plan.sas File location: __________________________________________________________________________________________________________________ Purpose: To demonstrate a few examples of the Plan Procedure in SAS. Author: Peter Clemmensen Creation Date: 12/04/2020 This program supports the blog post "Investigating the PROC PLAN in SAS by Example" on SASnrd.com *****************************************************************************************************************/ /* The numbers 1 to 10 in random order */ proc plan; factors a=10 / noprint; output out=want; run;quit; /* The same logic with data step code */ data want (keep=a); array r {10} _temporary_ (1 : 10); h = 10; do _N_ = 1 to 10; i = rand ("integer", h); a = r [i]; output; r [i] = r [h]; h = h-1; end; stop; run; /* Repeat the pattern from above three times */ proc plan; factors a=3 ordered b=10 / noprint; output out=want; run;quit; /* Generate permutations */ proc plan; factors a = 24 ordered b = 4 perm; output out=want; run;quit; proc transpose data=want out=want; by a; var b; run; /* Cyclical designs */ proc plan; factors a = 6 ordered b = 5 cyclic; output out=want; run;quit;