BookmarkSubscribeRSS Feed
nit123
Obsidian | Level 7

Hi All,

 

I am  trying to create a macro variable using Proc SQL and store it in a table.  but I am getting the above warning

 

WARNING: INTO clause is ignored in the CREATE TABLE statement.

proc sql;
create table t as select count(*) as c into :car from sashelp.cars;
quit;

 

any help would be appreciated.

 

Thank you,

Nitesh

2 REPLIES 2
Reeza
Super User

You can either create a macro or store it into a table, not both in a PROC SQL step. 

 

You can use two separate steps but it doesn't make a lot of sense given your current query, since you have a single value which is accessible in the macro variable.

 

proc sql noprint;
create table t as
select count(*) as c 
from sashelp.cars;

select c into :car from t;
quit;
DimaFrank
Calcite | Level 5

Try this query to initialize the macro variable.

 

proc sql;
select count(*) as c
into :car
from sashelp.cars;
quit;

 

%put &car.;

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
  • 3713 views
  • 3 likes
  • 3 in conversation