BookmarkSubscribeRSS Feed
mrdlau
Obsidian | Level 7

I usually like to view a quick 5 to 10 rows of my table so I can actually see the column names, and also get a feel of what sample data looks like.

 

I always tend to use the following:

proc sql inobs=10;
select * from table;
quit;

Is this the best way to view a quick sample of my data? From my experience, sometimes inobs=10 can generate a table really quick, and other times, it takes a long time to run.

 

 

Maybe I don't quite understand what an "inobs" does, but is this the best way to get a very fast look at my data?

2 REPLIES 2
Reeza
Super User

It should be fine, I use the equivalent, data step version. 

 

proc print data=have (obs=10) ;
run;

It's documented here:

http://documentation.sas.com/?docsetId=sqlproc&docsetTarget=n0a693shdq473qn1svlwshfci9rg.htm&docsetV...

mkeintz
PROC Star

As to widely varying times for 10 obs:

  1. Is the program using a multi-user system, or a client-server architecture?  These environments could generate highly variable competition for resources.
  2. Is your source data set a data set FILE, or a data set VIEW?  If it's the latter, there may be a lot of activity needed to generate 10 obs, as in:
    data table /view=table;
      do until(last.ticker);
        set quotes;
        by ticker;
        total_ask_shares=sum(total_ask_shares,ask_shares);
        total_bid_shares=sum(total_bid_shares,bid_shares);
      end;
    run;
    proc sql inobs=10;
      select * from table;
    quit
    If each stock ticker has 10,000 records in the quotes data set, then the first 10 obs in TABLE requires then first 100,000 observations in QUOTES.
--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1292 views
  • 0 likes
  • 3 in conversation