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.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.