This example creates a data set composed by 100 records and 10 variables, of which 5 numerical (with random values in the interval [0:1] and the others alphanumerical, obtained from conditions on the first five.
In order to run this example just paste the following statements in the Command area and press the execute button. To view the resulting data set just go in the PATH tab and refer to the one named Casualds.
dataset out=Casualds; newvar v1-v5=num; newvar v6-v19=text; for (int i=0; i<100; i++) { v1=Math.random(); v2=Math.random(); v3=Math.random(); v4=Math.random(); v5=Math.random(); v6="V1 less than .5"; v7="V2 less than .5"; v8="V3 less than .5"; v9="V4 less than .5"; v10="V5 less than .5"; if (v1>.5) v6="V1 greater than .5"; if (v2>.5) v7="V2 greater than .5"; if (v3>.5) v8="V3 greater than .5"; if (v4>.5) v9="V4 greater than .5"; if (v5>.5) v10="V5 greater than .5"; output; }; run; |