Date: Thu, 25 May 2006 14:20:17 -0700
Reply-To: "Pardee, Roy" <pardee.r@GHC.ORG>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Pardee, Roy" <pardee.r@GHC.ORG>
Subject: Re: make a data set from an empty data?
Content-Type: text/plain; charset="US-ASCII"
You could use a sql insert statement to work this I think:
proc sql;
create table tmplt
(a char(5),
b char(10),
c num);
insert into tmplt (a, b, c) values ('abc', 'xyz', 'abcxyz') ;
quit ;
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Huang, Ya
Sent: Thursday, May 25, 2006 2:11 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: make a data set from an empty data?
Thanks Toby,
My intentions was to use template data to set up the structure, In your
sample, those variable's attribute override the template Structure,
which is not what I wanted:
data xx;
a='abc';
b='xyz';
d=a||b;
output;
set tmplt;
run;
proc contents;
run;
# Variable Type Len Pos
-----------------------------------
1 a Char 3 8
2 b Char 3 11
4 c Num 8 0
3 d Char 6 14
I need a's length=5 and b's length=10.
Ya
-----Original Message-----
From: toby dunn [mailto:tobydunn@hotmail.com]
Sent: Thursday, May 25, 2006 2:00 PM
To: Huang, Ya; SAS-L@LISTSERV.UGA.EDU
Subject: RE: make a data set from an empty data?
Ya ,
proc sql;
create table tmplt
(a char(5),
b char(10),
c num);
data xx;
a='abc';
b='xyz';
d=a||b;
output;
set tmplt;
run;
proc print
data = xx ;
run ;
Toby Dunn
From: Ya Huang <ya.huang@AMYLIN.COM>
Reply-To: Ya Huang <ya.huang@AMYLIN.COM>
To: SAS-L@LISTSERV.UGA.EDU
Subject: make a data set from an empty data?
Date: Thu, 25 May 2006 16:52:28 -0400
proc sql;
create table tmplt
(a char(5),
b char(10),
c num);
data xx;
set tmplt;
a='abc';
b='xyz';
d=a||b;
output;
run;
OK, so I have a empty data with the structure I needed created by proc
sql. I then use a data step to fill in the records, and some new
variables. I got an empty data xx, even though I have the output
statement there.
Am I missing some obvious stuff? What should I do to make something (one
record) out of nothing (the original empty data)?
Thanks
Ya