Hi everyone.
I'd like to insert columns from table A into a new table called ''new", but got errors: File work.new.date does not exist.
Could you please give me some suggestions?
Thanks in advance!
PROC SQL;
INSERT INTO new
SELECT variable1, variable2, variable3
FROM A;
QUIT;
@runrunbunny wrote:
Hi everyone.
I'd like to insert columns from table A into a new table called ''new", but got errors: File work.new.date does not exist.
Could you please give me some suggestions?
Thanks in advance!
PROC SQL;
INSERT INTO new
SELECT variable1, variable2, variable3
FROM A;
QUIT;
Try
PROC SQL; Create table new as SELECT variable1, variable2, variable3 FROM A; QUIT;
The insert as you attempted requires the data set to exist, Create table creates the new set
Sounds like you don't have a dataset named NEW yet. So instead of trying to append observations to an existing dataset you want to make a new dataset. In SQL you would use CREATE TABLE for that.
create table new as
select variable1, variable2, variable3
from a
;
Or in regular SAS code a simple data step.
data new;
set a;
keep variable1-variable3;
run;
@runrunbunny wrote:
Hi everyone.
I'd like to insert columns from table A into a new table called ''new", but got errors: File work.new.date does not exist.
Could you please give me some suggestions?
Thanks in advance!
PROC SQL;
INSERT INTO new
SELECT variable1, variable2, variable3
FROM A;
QUIT;
Try
PROC SQL; Create table new as SELECT variable1, variable2, variable3 FROM A; QUIT;
The insert as you attempted requires the data set to exist, Create table creates the new set
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.