Random sample sql sas

I am having a problem with creating a random sample using proc sql which required to include some certain rows.

Libname newlib '/sas/sasdata/newlib';

CREATE TABLE NEWLIB.NEWTABLE * FROM OLDLIB.OLDTABLE AS OLDTABLE

WHERE OLDTABLE .VARIABLE_A IN (1,2,3,4,5);

How can I add 10 more rows of random sample into NEWTABLE from OLDTABLE?

1 ACCEPTED SOLUTION
Accepted Solutions Lapis Lazuli | Level 10 Re: Create a random sample using proc sql Posted 05-10-2012 09:32 AM (14446 views) | In reply to Nehcour0420

/This one doesn't work */

data have;
input VARIABLE_A :VARIABLE_B :$2. VARIABLE_C ;
cards;
1 aa 123
2 aa 235
3 bb 453
4 dd 111
5 ss 123
6 sf 234
7 ad 234
8 ae 675
9 ss 222
10 ss 123
11 ee 877
12 aa 123
13 aa 235
14 bb 453
15 dd 111
16 ss 123
17 sf 234
18 ad 234
19 ae 675
20 ss 222
21 ss 123
22 ee 877

7 REPLIES 7 Lapis Lazuli | Level 10 Re: Create a random sample using proc sql Posted 05-10-2012 08:44 AM (9650 views) | In reply to Nehcour0420

proc sql outobs=10;

create table random10 as

select *,ranuni(99) as nn from sashelp.class

where age in (11,12,15)

obs Name Sex Age Height Weight nn

1 Jane F 12 59.8 84.5 0.03878

2 William M 15 66.5 112.0 0.11254

3 Joyce F 11 51.3 50.5 0.23866

4 James M 12 57.3 83.0 0.31129

5 Janet F 15 62.5 112.5 0.58261

6 Thomas M 11 57.5 85.0 0.59009

7 Robert M 12 64.8 128.0 0.63748

8 John M 12 59.0 99.5 0.68047

9 Mary F 15 66.5 112.0 0.75494

10 Ronald M 15 67.0 133.0 0.92961