BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
David_Billa
Rhodochrosite | Level 12

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Shmuel
Garnet | Level 18

do it as:

options obs=100;

/* extraction code put here */

options obs=max;

View solution in original post

4 REPLIES 4
Shmuel
Garnet | Level 18

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.

David_Billa
Rhodochrosite | Level 12
Should I add the options statement in precode of extract transformation?
Shmuel
Garnet | Level 18

do it as:

options obs=100;

/* extraction code put here */

options obs=max;
novinosrin
Tourmaline | Level 20

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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to connect to databases in SAS Viya

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.

Discussion stats
  • 4 replies
  • 6644 views
  • 0 likes
  • 3 in conversation