I am posting a (hopefully correct) response for "How to select first few records to test the Proc SQL", which has a non-working solution, and is locked:
@LAP @srinidelite @SimonJF @ChrisNZ @Reeza @LinusH the solution I came up with is:
Proc Sql outobs=10;
create table TESTRESULT as
select COL1, COL2
from YOURLIB.YOURTABLE
where YOURFILTERS;
quit;
If there is no error in the SQL statement, this will return 10 records and produce &syscc = 4 / &sqlrc = 4 (warning.)
You need to code to check SYSCC/SQLRC, if you are checking for warnings or errors.
Using option OUTOBS= is the chosen solution. As I see it, this post brings no value to a topic closed 12 years ago.
> Unclear where OUTOBS= is supposed to go.
Really?
Here is first line of the chosen reply:
you can use inobs= or outobs= option on the PROC SQL statement.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.