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
Calling all data scientists and open-source enthusiasts! Want to solve real problems that impact your company or the world? Register to hack by August 31st!
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.