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-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!

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.

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
  • 4 replies
  • 968 views
  • 0 likes
  • 4 in conversation