BookmarkSubscribeRSS Feed
DanielLopez
Calcite | Level 5
How can I "actively" change the output name of a Table in Sas Enterprise Guide using a &processmonth parameter, using a query builder?
For example if I'm running data for 2015-12 and i want for the final table to have a standard name prefix such as: "SAS_PM_BEHAVIOR_&processmonth"
Can this be done with Query Builder? I tried but it disn't work.
Help please to all you SAS gurus out there!
9 REPLIES 9
Reeza
Super User
I believe so. There's a place in Query Builder to specify the output table name. There you can place the code you have above.
Patrick
Opal | Level 21

What @Reeza proposes works in my EG version (7.11) only if changing the table name via Options/Change Button as shown below.

 

Capture.PNG

 

If I just enter the name into the "Output name" field then it get's quoted as name literal and generates code like

CREATE TABLE WORK.'test&test'n AS 

 

Only after the rename via "options" drop-down I'm getting the table name generated without quoting.

CREATE TABLE WORK.test&test AS 

DanielLopez
Calcite | Level 5

First of all thanks for answering so quickly. 

I just tried this but I get the following error:

 

SAS_parameter error.JPG

Any clues?

Patrick
Opal | Level 21

It works in my 7.11 EG version.

DanielLopez
Calcite | Level 5

Do I have to set up a special condition under the Prompt Manager option or Tools>Options?

Do you think it might be due to the EG version that I have which is earlier than yours?

 

--

DLP

Patrick
Opal | Level 21

I've run first the following code for my test.

%let test=myTest;
data test;
  set sashelp.class;
run;

Then I've used the query builder as alredy posted.

 

If this doesn't work for you then I must assume it's caused by an earlier version of SAS EG.

 

Reeza
Super User
What version of EG do you have? I would also considering a quick call to Tech Support or a repost to EG group so that some of the EG users can help.
DanielLopez
Calcite | Level 5

I'm using version 5.1. Could that be the reason it does not work?
I will try calling Tech Support.  Any other help on this is deeply appreciated.  
Thanks

ChrisHemedinger
Community Manager

The solution that @Patrick supplied is creative, but it's a bit of a trick that might be working by accident, and not by design.

 

As far as I know, there isn't an official method to substitute in a macro value for the output data name in the Query Builder.  My suggested workaround would be:

 

- Create the query to output to a known, static name (ex: work.currentmonth).

- Link a subsequent program node that renames/copies that data set to the name you want, using the macro variable that you supply.  You could do this with DATA step or PROC COPY or PROC DATASETS.

 

Chris

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 9 replies
  • 2650 views
  • 0 likes
  • 4 in conversation