Date: Wed, 16 Aug 2006 15:30:00 -0400
Reply-To: Joe Whitehurst <joewhitehurst@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Joe Whitehurst <joewhitehurst@GMAIL.COM>
Subject: Re: how to copy the structure of a table instead of data
In-Reply-To: <8B5E9B95CC245C46A68BF4495A29A7EEB3C339@chpdm-mail.chpdm.umbc.edu>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
And, let's not forget the NEW call routine which has several
advantages over all the previously mentioned methods:
CALL NEW(table-name,model-table,num-row, display-window);
table-name
is the SAS table to be created, specified as <libref.>member. The
default library, USER, is used if libref is omitted. If a null string
('') is specified for table-name, then the DATAn naming convention is
used to create a table in the USER library.
Type: Character
model-table
is an existing SAS table after which the new SAS table is to be
modeled. Use a null string ('') as a placeholder if you do not want to
specify a model table.
Type: Character
num-row
is the number of initial rows for the new SAS table. This value must
be equal to or greater than 0. All columns in all rows initially
contain missing values. The value for num-row cannot be a missing
value.
Type: Numeric
display-window
specifies whether the NEW window is displayed so that column
definitions for the new SAS table can be edited before the table is
created:
'Y' displays the NEW window to allow editing of the column names and
attributes before the new SAS table is created. (This is the default.)
'N' does not display the NEW window. The column definitions in the new
SAS table will be an exact replica of those in the model table. A
value must also be supplied for model-table.
Joe
On 8/16/06, Jack Clark <JClark@chpdm.umbc.edu> wrote:
> WenSui,
>
> I'm not sure where you want to copy the structure. If you mean to create a
> new dataset (table) with zero observations, but with the same structure of
> an existing dataset, try this:
>
>
> data test;
> x = 'AA';
> y = 'WHY';
> z = 67;
> output;
> run;
>
> data test2;
> set test (obs=0);
> run;
>
> proc contents data=test;
> run;
>
> proc contents data = test2;
> run;
>
> Dataset Test2 should have the same structure, without any of the data.
>
> Jack Clark
> Research Analyst
> Center for Health Program Development and Management
> University of Maryland, Baltimore County
>
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Wensui
> Liu
> Sent: Wednesday, August 16, 2006 2:59 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: how to copy the structure of a table instead of data
>
> Dear Listers,
>
> Is there any way I can copy the structure of a table? I just need the
> structure and don't want any data in it.
>
> Thanks.
>
> --
> WenSui Liu
> (http://spaces.msn.com/statcompute/blog)
> Senior Decision Support Analyst
> Health Policy and Clinical Effectiveness
> Cincinnati Children Hospital Medical Center
>