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

I want to create a GT that can take two (or more) input tables. In my previous GT I used the following code to reference the last connnected table, but that was the only one connected to GT:

data OUTPUTDATA;

set &SYSLAST;

....

and I could reference the &SYSLAST in a 'merge' statement.

Now I want to merge records from two input tables.

I want to resolve this before l post further details of the work that I want to complete.

Any help is appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

The suggestion was that the names would be in MACRO variables.

Try changing _INPUT2 to &_INPUT2 in your code.

Is there some way to see the code and/or log from the generated transform to see if it does reference macro variables?

View solution in original post

5 REPLIES 5
twocanbazza
Quartz | Level 8

Isn't there _input Macro vars? ie _Input1 is the first input table etc.

Barry

Halaku
Obsidian | Level 7

That is correct.

Following is my code in the GT:

--------------------- code ---------------------------------------------

data CODES;

proc sql noprint;

     select CONFIGID, PARAMETER_2, RESULT_VAL_CODE as SUBTYPE from _INPUT2

      where CONFIGID='xxx1' and PARAMETER_2='xxx2';

     %put CONFIGID PARAMETER_2 SUBTYPE;

quit;

%put CONFIGID PARAMETER_2 SUBTYPE;

run;

--------------------- code ---------------------------------------------

But when I reference these I get an error message:

--------------------- log ---------------------------------------------

174        proc sql noprint;

175             select CONFIGID, PARAMETER_2, RESULT_VAL_CODE as SUBTYPE from _INPUT2

176              where CONFIGID='xxx1' and PARAMETER_2='xxx2';

ERROR: File WORK._INPUT2.DATA does not exist.

NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.

177             %put CONFIGID PARAMETER_2 SUBTYPE;

CONFIGID PARAMETER_2 SUBTYPE

178       

179        quit;

NOTE: The SAS System stopped processing this step because of errors.

NOTE: PROCEDURE SQL used (Total process time):

      real time           0.01 seconds

      cpu time            0.01 seconds

--------------------- log ---------------------------------------------

I think there is more to it to reference the inout tables.

Tom
Super User Tom
Super User

The suggestion was that the names would be in MACRO variables.

Try changing _INPUT2 to &_INPUT2 in your code.

Is there some way to see the code and/or log from the generated transform to see if it does reference macro variables?

Halaku
Obsidian | Level 7

Thanks Tom. That helped. So that means I do not need to use the

set &SYSLAST;

but a direct reference is OK.

Also, the &_INPUT# usage depnds on the order of input table joins.

Thanks,

twocanbazza
Quartz | Level 8

hmmmm, I was hoping for the Correct answer points Smiley Wink

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 1352 views
  • 0 likes
  • 3 in conversation