Resources

Getting Started Section for PROC SIMNORMAL

/****************************************************************/
/*          S A S   S A M P L E   L I B R A R Y                 */
/*                                                              */
/*    NAME: SIMNGS                                              */
/*   TITLE: Getting Started Section for PROC SIMNORMAL          */
/* PRODUCT: STAT                                                */
/*  SYSTEM: ALL                                                 */
/*    KEYS: cluster analysis, Fisher's Iris Data                */
/*   PROCS: SIMNORMAL, SGPANEL                                  */
/*    DATA:                                                     */
/*                                                              */
/* SUPPORT: sasrbk                                              */
/*     REF: PROC SIMNORMAL, GETTING STARTED.                    */
/*    MISC:                                                     */
/****************************************************************/
data a ;
   input in1-in5 out1-out5 ;
   datalines ;
 9.3500    10.0964     7.3177    10.3617    10.3444    9.4612
10.7443     9.9026     9.0144    11.7968
 7.8599    10.4560    10.0075     8.5875    10.0014   10.3869
10.0319     8.7264     9.3306     9.8098
12.5886    11.3163    11.8115     9.0628    12.6694    9.6108
10.2662    13.1366    11.0254    11.3773
 9.9428     8.2846    10.8356    11.9906    12.9336    9.3667
10.5318    11.9750    11.4610    10.9581
 8.3970     9.8454     8.2299     8.7416     8.4052   10.1844
 9.4807     7.6435    10.4809     7.8606
10.5573     9.6956     9.5262     9.2250     8.0085    8.2300
 8.5657    10.5898    10.4297    10.2284
 9.7613    11.5905     9.2133    11.1151     9.7522    9.9407
10.9277    13.7420    12.2711    10.1207
10.8286    10.9144    10.6808    10.5639    11.2950   11.1085
 9.9825     9.5768    10.3212    10.7541
11.2653     8.5778    10.6001     9.1377     9.6161    9.6414
10.4348    11.1354     8.5845    10.9104
 9.9077    11.2783    11.1208     9.8051    11.9365   11.3171
10.7636    12.4580    10.0363     9.1748
 9.8136     9.9700     9.6590    10.5184    10.6690    8.9130
10.0852     7.7743    11.0649    10.8624
 9.9562     9.8748    10.8398    10.3418    10.6932    9.1549
10.6553     8.7553    10.3763     9.7415
 9.8535    10.2414     9.7442     9.7692     9.7095    8.6388
 9.7515    10.2349     9.3828     9.4418
11.6525    11.1020    11.1826    10.0248    10.6498   10.2986
10.3593    10.0633     8.6958    10.7087
10.5432    10.6476    10.4037    11.2058    10.1598   10.1026
11.2901    10.3261    10.4230     9.3612
11.3348     9.5084    12.2402    10.3202    10.0206    9.7563
10.4351    10.7358    10.3912    11.2582
10.5909    10.5092    11.9656     8.9874     9.6810    9.9253
11.1644    12.1824     9.0730    11.1632
10.0811     8.6558     9.1581    10.0577    10.0339    8.0122
10.4457     8.1740     9.3986    10.1505
10.3734    11.0149     9.4445    11.4697    10.0483    8.9591
10.2492    11.0136     8.4309     8.8752
11.8052    10.6245    12.4008    10.5288    10.2659   10.7138
10.6644     9.4493     9.9725    11.3204
 7.6350     9.7251     9.9344     7.4049     9.2738    9.6225
10.2990     8.5283     9.4226     9.8462
10.6700     9.2547     7.9179    10.9680     9.0470   10.5172
11.0682     9.2067     9.4464     8.9698
 9.6060    10.2322    11.3902     9.5530    10.4153   10.0591
 9.2427    10.9040    10.9600    10.1884
10.4031    10.7302     9.3377    10.0428    10.4137    9.8371
10.7636     9.8891    12.4523     9.0787
11.9590     9.2255    10.7898    11.8466    10.0328   10.4962
11.5153    11.3190    10.3698     9.8620
 9.3285    10.2110    11.6337     9.2343     7.9668    8.4385
 7.7642    10.1570    10.3717     9.8983
 9.0351     8.9160     9.6875     7.9994     9.2997    9.4001
 9.3936    10.1704     9.7477    10.2489
11.2492     9.4304     8.5972     9.5218    12.2664    8.8711
 8.8471    12.2303    11.0712     9.2681
10.9434     9.3444     8.4147    10.8947    11.0544   11.1194
 9.1075     9.9427    10.7306    10.4794
10.2272     8.9799    11.4652    10.2473    10.2082   10.2353
 9.2674     9.5249     8.7748    10.7802
 9.2188     9.1639     8.7305    11.3976     7.3337    9.5241
 9.5236     7.2966     9.8491    10.4329
 9.3982    12.1403     9.5161     9.4402    10.6636   10.2805
 9.1674     9.8748    10.0721    11.1451
10.6985    10.5270    10.4953    10.6301    11.6251   12.2466
 8.5052    10.1537     9.3549    10.8182
 9.8664    10.2981    10.0288    11.4336    12.4351   10.9603
 9.8591    11.8634     9.1830    10.1749
 9.2593     9.4654    10.6265     9.7779     7.2335    9.6939
 7.9195     8.5725     9.5281     9.4185
11.4900    10.0333     8.7236     9.7922    10.5732   10.6480
10.5992     8.7604    10.1736    11.2201
10.6940     9.3488    10.8881    11.2154    12.1908    9.2411
 9.9766    10.1539    10.8198    10.8697
 9.6861     8.1258     9.0939     8.5354     9.7900   10.8520
 9.5214    11.5617     9.4471    10.1581
10.5009    10.7138    10.3537     8.8186    10.5654   11.3757
11.3384    10.4395    11.1662    10.4728
10.8556    11.0991    10.6216     9.2077    10.5472    9.1114
 9.1957    10.5509    11.4410    10.8896
10.1155     9.9652    10.9634    10.4003    10.6376   10.7155
12.0945    10.8618    10.5147    10.9204
10.9784    13.7831     9.7188    11.0254     8.4312    8.5432
 8.0490    10.8059    10.1095     9.5182
10.5198    11.2865    10.7693    11.6369    11.7870    9.2664
 8.8473    11.1268     9.5358    11.9600
 9.4364     8.7912    11.2842    10.4714    10.5446    9.0303
10.4719    11.6274    11.2040    10.7933
10.8263    10.1654    11.0058    10.2358     9.8681    9.4571
10.6146    11.1651    11.2819     9.1157
 9.1880    10.2725     8.3612     9.5558     9.6009    8.7859
 9.3810     9.9732     9.4727    10.6121
 9.7681     9.7874    10.6328    10.0921     9.0405    9.3359
 9.5149    10.5003    10.0585    10.4616
11.0365     9.5001     8.8324     8.8197     9.6662   10.1306
11.0010    10.2565    11.0918    10.2825
 8.4966    10.7729    11.3764    10.1385    10.7957   10.4092
 9.8327     9.8199    10.5386     9.2822
 9.9412     9.8433     9.8716     9.7898    11.0926   10.7469
 8.9174     9.9623     9.5742     9.9713
run ;
proc corr data=a cov nocorr outp=outcov ;
   var in1-in5 out1-out5 ;
run ;
data cond1 ;
   _TYPE_='COND' ;
   in1 = 8    ;
   in2 = 10.5 ;
   in3 = 12   ;
   in4 = 13.5 ;
   in5 = 14.4 ;
   output ;
run ;

data cond2 ;
   _TYPE_='COND' ;
   in1 = 15.4 ;
   in2 = 13.7 ;
   in3 = 11 ;
   in4 = 7.9 ;
   in5 = 5.5 ;
   output ;
run ;
data outcov1 ;
   input=1 ;
   set outcov cond1 ;
run ;

data outcov2 ;
   input=2 ;
   set outcov cond2 ;
run ;
data outcov ;
   set outcov1 outcov2 ;
run ;
proc print data=outcov ;
   where (_type_ ne 'COV') ;
run ;
proc simnormal data=outcov(type=cov)
      out = osim
      numreal = 500
      seed = 33179
      ;
   by input ;
   var out1-out5 ;
   cond in1-in5 ;
run;

data b;
   set osim ;
   denom = sum(of out1-out5) ;
   if abs(denom) < 1e-8 then ff = . ;
   else ff = (out1-out3)/denom ;
run ;
proc univariate data=b ;
   by input ;
   var ff ;
run ;
title ;
proc sgpanel data=b ;
   panelby input ;
   REFLINE 0 / axis= x ;
   density ff ;
run ;