Marco De Virgilis
Marco De Virgilis

Reputation: 1089

copy table subset sas

I am new to sas and I still trying to figure out how it works. My problem is to copy only a subset of a table and I have tried the following:

proc copy in=inlib out=work;
   select mytable (obs=10000);
run;

However it looks like I cannot apply the obs option during the proc copy. How can I achieve this with proc copy?

Upvotes: 1

Views: 189

Answers (2)

Rosie Thomas
Rosie Thomas

Reputation: 63

There is no need to use a proc copy here; a data step should do the job (perhaps with the exception of if the dataset is indexed?). Data steps are the main ingredient of SAS so it's a good idea to get used to them!

Just run:

data mytable;
set inlib.mytable (obs=10000);
run;

This way you can also use keep or where statements for more complex filtering or columns or observations.

Upvotes: 0

data _null_
data _null_

Reputation: 9109

Use the SAS System option OBS=; Don't forget to set is back.

enter image description here

Upvotes: 3

Related Questions