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.
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?
Isn't there _input Macro vars? ie _Input1 is the first input table etc.
Barry
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.
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?
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,
hmmmm, I was hoping for the Correct answer points
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.