BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
robm
Quartz | Level 8

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;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

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

2 REPLIES 2
Reeza
Super User

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...

 

PGStats
Opal | Level 21

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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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