I want to extract only first 100 obs in Extract Transformation. Input data is SQL table which was already registered in SAS. I tried with table options but it's not producing the desired output.
do it as:
options obs=100;
/* extraction code put here */
options obs=max;
Add OPTIONS OBS=100; preceding the extraction step.
Don't forget to reset it after the extraction by OPTIONS OBS=MAX;
If still have the same undesired result please post the full log of the running extraction.
do it as:
options obs=100;
/* extraction code put here */
options obs=max;
or You could try OBS=100 as a dataset option as an alernative to global options statement-
data want;
set have(obs=100); /*dataset option obs=100*/
run;
/*Or Using _N_ iteration counter*/
data want;
set have;
if _n_>100 then stop;
run;
/*Dataset option in SQL*/
proc sql ;
create table want as
select *
from have(obs=100);
quit;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.