BookmarkSubscribeRSS Feed
tmcrouse
Calcite | Level 5

If I only want 10 observations to output, where in the code would I place that. If I do not do observations I end up with 4996 pages.

ODS RTF FILE='C:\documents and settings\tmill29\my documents\my sas files\9.2\readmin\readm2.RTF';

PROC FREQ DATA = ReAdm.CHI ORDER = DATA; BY COMPARISON;

WEIGHT COUNT;

TABLES SVRTY_LVL_CD*WHO*ADMISSION/CMH EXPECTED OUTEXPECT;

EXACT OR;

OUTPUT OUT = ReAdm.Final OR CMH;

RUN;

ODS RTF CLOSE;

4 REPLIES 4
Keith
Obsidian | Level 7

With SAS procedures, I believe you can only control the number of observations being read in (using OBS= with the option statement or as a dataset option), not the number being output.  The only exception I know of is PROC SQL where you can use the OUTOBS= option.

If you want to restrict the number to test the code, then set OBS=  as below.

PROC FREQ DATA = ReAdm.CHI (OBS=100)

PaigeMiller
Diamond | Level 26

Keith, that's 100 observations input, which doesn't seem to answer the question.

I consider the original question unclear, as there is no relationship that I know of between observations and pages, yet you speak of both as if they are interchangeable.

I think you mean to say that the output data set to have 10 observations, in which case you want

OUTPUT OUT = readm.final(obs=10) or cmh;

--
Paige Miller
Keith
Obsidian | Level 7

Hi PaigeMiller,

The OBS= dataset option can only be used against the input dataset, it has no effect when applied against an output dataset.  I stated that I don't think it is possible to achieve the desired result, what @tmcrouse didn't say was why there is a requirement to have only 10 output observations.  I merely stated that if data checking was the purpose then this could be achieved by limiting the number of input observations.

Tom
Super User Tom
Super User

Sounds like you want the printed output to only have a subset of the data.

Why not use the NOPRINT (or ODS CLOSE) and instead use proc freq to write a dataset and then print the dataset with an OBS= dataset option.

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1268 views
  • 0 likes
  • 4 in conversation