BookmarkSubscribeRSS Feed
noobs
Calcite | Level 5

Hello SAS EG Users,

What is the best way to count number of observations in SAS dataset, when it shows question mark while scrolling from top to bottom in tooltip that generally says "x of y" where y represents total number of observations in dataset.

Proc SQL;

Select count(*)

from WORK.<datasetname>;

quit;

Can above code be used or does it need some modifications? I haven't used PROC SQL in a while Smiley Happy

Thanks,

Dhanashree

2 REPLIES 2
Reeza
Super User

Depends on what you want to do with it.

You can right click a data set, see the properties which includes the number of observations.

Your code above will print to screen.

Also, you should try your code rather than ask if it works...

ChrisHemedinger
Community Manager

The [?] appears when accessing a VIEW or sometimes a DMBS table (via a SAS/ACCESS library) when the row count isn't available.

You can try the PROC SQL step, or perhaps glean some information from the Summary Statistics task, One-Way Frequencies task or Data Set Attributes task.  If you use Summary Statistics or One-Way Frequencies, and if the table is a DBMS table, then SAS will actually push that "counting work" down to the database, which should be more efficient.

Chris

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 2398 views
  • 0 likes
  • 3 in conversation