DATA Step, Macro, Functions and more

proc sql and the select into question

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 77
Accepted Solution

proc sql and the select into question

I have this proc sql below ...can you not use the select into statement? the error I get is below that

 

proc sql;
select memname as sas,name as vgroups into uompc.SAStoVGroups from work.vgroups
quit;

 

 


3042 proc sql;
3043 select memname as sas,name as vgroups into uompc.SAStoVGroups from work.vgroups
-----
79
76
ERROR 79-322: Expecting a :.

ERROR 76-322: Syntax error, statement will be ignored.

3044 quit;

 

 


Accepted Solutions
Solution
‎09-15-2016 04:07 PM
Respected Advisor
Posts: 4,641

Re: proc sql and the select into question

Use the documented syntax. SELECT INTO is for giving values to SAS macro variables.INSERT INTO is for adding observations to an existing table. To create a table, use CREATE TABLE:

 

proc sql;
create table uompc.SAStoVGroups as
select 
	memname as sas,
	name as vgroups 
from work.vgroups;
quit;
PG

View solution in original post


All Replies
Super User
Posts: 17,750

Re: proc sql and the select into question

No, that's not SAS SQL.

 

In SAS you use a CREATE TABLE statement instead.

 

proc sql;
create table uompc.SAStoVGroups as
select ..
from
...

Probably easiest to scan through the examples:

http://support.sas.com/documentation/cdl/en/sqlproc/69049/HTML/default/viewer.htm#n1ncn0pznd8wrln1tn...

 

Solution
‎09-15-2016 04:07 PM
Respected Advisor
Posts: 4,641

Re: proc sql and the select into question

Use the documented syntax. SELECT INTO is for giving values to SAS macro variables.INSERT INTO is for adding observations to an existing table. To create a table, use CREATE TABLE:

 

proc sql;
create table uompc.SAStoVGroups as
select 
	memname as sas,
	name as vgroups 
from work.vgroups;
quit;
PG
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 314 views
  • 0 likes
  • 3 in conversation