Calling Jack Hamilton: re Saving space

  • Follow


Jack,

Firstly, many thanks for your always useful posts.

In a thread in January where the OP was asking how to decrease the
size of a dataset you said; "You can reduce the size of your data set
by reducing the number of observations....".

I just did a test of this by running a Proc Contents on a dataset both
before and after deleting a load of obs and the After size showed as
being identical to the Before. So the question is; Is your statement
correct?



cheers
Andre
0
Reply andre.dalet (6) 11/18/2009 11:41:44 PM

On Nov 18, 3:41=A0pm, Andre <andre.da...@gmail.com> wrote:
> Jack,
>
> Firstly, many thanks for your always useful posts.
>
> In a thread in January where the OP was asking how to decrease the
> size of a dataset you said; "You can reduce the size of your data set
> by reducing the number of observations....".
>
> I just did a test of this by running a Proc Contents on a dataset both
> before and after deleting a load of obs and the After size showed as
> being identical to the Before. So the question is; Is your statement
> correct?
>
> cheers
> Andre

I think you need to check the number of physical observations against
the number of logical observartions. When updating in place ie insert,
update and delete operations SAS makes some observations for deletion,
but the observations are still 'physically' there.

Try the following two macros on you dataset.

/* T000030 NUMBER OF LOGICAL OBSERVATIONS(NO WHERE CLAUSE) IN A
DATASET */
   %macro utl_nlobs(dsn);
     %let dsid=3D%sysfunc(open(&dsn));%sysfunc(attrn(&dsid,nlobs)) %let
rc=3D%sysfunc(close(&dsid));
   %mend utl_lnobs;
   %put *** sashelp.class has %utl_nlobs(sashelp.class) logical
observations ***;

/* T000031 NUMBER OF PHYSICAL OBSERVATIONS(NO WHERE CLAUSE) (BEST
NUMBER OF OBS?) */
   %macro utl_nobs(dsn);
     %let dsid=3D%sysfunc(open(&dsn));%sysfunc(attrn(&dsid,nobs)) %let
rc=3D%sysfunc(close(&dsid));
   %mend utl_nobs;
   %put *** sashelp.class has %utlnobs(sashelp.class) physical
observations ***;

I don't know what the qwickest way to remove the physical observations
marked for deletion, perhaps proc append.
0
Reply xlr82sas 11/19/2009 1:29:27 AM


On Nov 19, 11:29=A0am, xlr82sas <xlr82...@aol.com> wrote:
> On Nov 18, 3:41=A0pm, Andre <andre.da...@gmail.com> wrote:
>
> > Jack,
>
> > Firstly, many thanks for your always useful posts.
>
> > In a thread in January where the OP was asking how to decrease the
> > size of a dataset you said; "You can reduce the size of your data set
> > by reducing the number of observations....".
>
> > I just did a test of this by running a Proc Contents on a dataset both
> > before and after deleting a load of obs and the After size showed as
> > being identical to the Before. So the question is; Is your statement
> > correct?
>
> > cheers
> > Andre
>
> I think you need to check the number of physical observations against
> the number of logical observartions. When updating in place ie insert,
> update and delete operations SAS makes some observations for deletion,
> but the observations are still 'physically' there.
>
> Try the following two macros on you dataset.
>
> /* T000030 NUMBER OF LOGICAL OBSERVATIONS(NO WHERE CLAUSE) IN A
> DATASET */
> =A0 =A0%macro utl_nlobs(dsn);
> =A0 =A0 =A0%let dsid=3D%sysfunc(open(&dsn));%sysfunc(attrn(&dsid,nlobs)) =
%let
> rc=3D%sysfunc(close(&dsid));
> =A0 =A0%mend utl_lnobs;
> =A0 =A0%put *** sashelp.class has %utl_nlobs(sashelp.class) logical
> observations ***;
>
> /* T000031 NUMBER OF PHYSICAL OBSERVATIONS(NO WHERE CLAUSE) (BEST
> NUMBER OF OBS?) */
> =A0 =A0%macro utl_nobs(dsn);
> =A0 =A0 =A0%let dsid=3D%sysfunc(open(&dsn));%sysfunc(attrn(&dsid,nobs)) %=
let
> rc=3D%sysfunc(close(&dsid));
> =A0 =A0%mend utl_nobs;
> =A0 =A0%put *** sashelp.class has %utlnobs(sashelp.class) physical
> observations ***;
>

You don't need to run these. The info provided by Proc Contents tell
you that nnnn obs have been deleted.

> I don't know what the qwickest way to remove the physical observations
> marked for deletion, perhaps proc append.

Don't know.
I tried a Proc Sort before I posted but that had no effect on the
space.



cheers
Andre

0
Reply Andre 11/19/2009 1:36:48 AM

Did you remove enough observations to make a difference in the size?
SAS allocates the space in blocks that could contain multiple
observations.  I believe that information is included in the
information printed by PROC CONTENTS.

Otherwise when you ran PROC SORT did it actually sort or did it say to
the effect "data already sorted so doing nothing"?  Try sorting to a
NEW dataset name and check the size.

Are you running on an IBM Mainframe?  If so the space used by the
partitioned dataset that SAS is using to store you SAS library will
not decrease when you delete observataions or even whole datasets from
the library. Also see the other current thread on using SAS on
mainframe.

- Tom Abernathy


On Nov 18, 8:36=A0pm, Andre <andre.da...@gmail.com> wrote:
> On Nov 19, 11:29=A0am, xlr82sas <xlr82...@aol.com> wrote:
>
>
>
>
>
> > On Nov 18, 3:41=A0pm, Andre <andre.da...@gmail.com> wrote:
>
> > > Jack,
>
> > > Firstly, many thanks for your always useful posts.
>
> > > In a thread in January where the OP was asking how to decrease the
> > > size of a dataset you said; "You can reduce the size of your data set
> > > by reducing the number of observations....".
>
> > > I just did a test of this by running a Proc Contents on a dataset bot=
h
> > > before and after deleting a load of obs and the After size showed as
> > > being identical to the Before. So the question is; Is your statement
> > > correct?
>
> > > cheers
> > > Andre
>
> > I think you need to check the number of physical observations against
> > the number of logical observartions. When updating in place ie insert,
> > update and delete operations SAS makes some observations for deletion,
> > but the observations are still 'physically' there.
>
> > Try the following two macros on you dataset.
>
> > /* T000030 NUMBER OF LOGICAL OBSERVATIONS(NO WHERE CLAUSE) IN A
> > DATASET */
> > =A0 =A0%macro utl_nlobs(dsn);
> > =A0 =A0 =A0%let dsid=3D%sysfunc(open(&dsn));%sysfunc(attrn(&dsid,nlobs)=
) %let
> > rc=3D%sysfunc(close(&dsid));
> > =A0 =A0%mend utl_lnobs;
> > =A0 =A0%put *** sashelp.class has %utl_nlobs(sashelp.class) logical
> > observations ***;
>
> > /* T000031 NUMBER OF PHYSICAL OBSERVATIONS(NO WHERE CLAUSE) (BEST
> > NUMBER OF OBS?) */
> > =A0 =A0%macro utl_nobs(dsn);
> > =A0 =A0 =A0%let dsid=3D%sysfunc(open(&dsn));%sysfunc(attrn(&dsid,nobs))=
 %let
> > rc=3D%sysfunc(close(&dsid));
> > =A0 =A0%mend utl_nobs;
> > =A0 =A0%put *** sashelp.class has %utlnobs(sashelp.class) physical
> > observations ***;
>
> You don't need to run these. The info provided by Proc Contents tell
> you that nnnn obs have been deleted.
>
> > I don't know what the qwickest way to remove the physical observations
> > marked for deletion, perhaps proc append.
>
> Don't know.
> I tried a Proc Sort before I posted but that had no effect on the
> space.
>
> cheers
> Andre- Hide quoted text -
>
> - Show quoted text -

0
Reply Tom 11/19/2009 2:30:45 AM

On Nov 19, 12:30=A0pm, Tom Abernathy <tom.aberna...@gmail.com> wrote:
> Did you remove enough observations to make a difference in the size?

Yep. Reduced it from 17mb to 6mb.

> SAS allocates the space in blocks that could contain multiple
> observations. =A0I believe that information is included in the
> information printed by PROC CONTENTS.
>
> Otherwise when you ran PROC SORT did it actually sort or did it say to
> the effect "data already sorted so doing nothing"? =A0Try sorting to a
> NEW dataset name and check the size.

No. I sorted it by a different var to what it had been sorted on.
>
> Are you running on an IBM Mainframe? =A0

Nope. Running EG 9.1 on a dedicated server.



cheers
Andre
0
Reply Andre 11/19/2009 3:12:56 AM

4 Replies
138 Views

(page loaded in 0.051 seconds)

Similiar Articles:













7/12/2012 8:56:05 PM


Reply: