Help using Base SAS procedures

out obs help

Reply
Contributor
Posts: 69

out obs help

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;

Regular Contributor
Posts: 151

Re: out obs help

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)

Trusted Advisor
Posts: 1,931

Re: out obs help

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;

Regular Contributor
Posts: 151

Re: out obs help

Posted in reply to PaigeMiller

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.

Super User
Super User
Posts: 7,074

Re: out obs help

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.

Ask a Question
Discussion stats
  • 4 replies
  • 296 views
  • 0 likes
  • 4 in conversation