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

All

  • Open Job from DI studio
  • Click on Run -> The job will run with a warning as mentioned below

sathya66_1-1613131769789.png

 

  1. Now only run transformation 3 -> It runs fine, and macro is resolved fine
  2. Then run the whole job again -> It runs fine
  3. Now close the job, open it again and run the whole job -> Same  with a warning as above

Any idea? I thought it’s  assigning a macro globally but 2nd  step is working so its not a global macro issue.

1 ACCEPTED SOLUTION

Accepted Solutions
sathya66
Barite | Level 11
Recreated the main job , sub/inner job from scratch and working fine

View solution in original post

9 REPLIES 9
PaigeMiller
Diamond | Level 26

The macro variable &wt05_count does not exist. Then, somewhere along the way, the macro variable &wt05_count is created and you don't get the WARNING. When you create a new job, it doesn't know about the macro variables from other jobs. Other than that, we can't say as you have shown us only a small portion of the program.

--
Paige Miller
sathya66
Barite | Level 11

Thanks,

This is a simple user witten code in the user written transofrm . I tested once again and it looks like an issue if add a sub job(job in a job)  if I add a sub job to a job then it is not working. If I remove the subjob then it is working.

nothing to do with subjob but not sure why macro is not resolving.

 

sathya66_0-1613137988248.png

 

 

proc sql;
    connect to teradata  ( user=myusr1 password=mypwd1 );
    select * from connection to teradata 
	(select count(*) as count into:wt05_count from test)
	;
    disconnect from teradata;
    quit;
  %put &wt05_count

 

japelin
Rhodochrosite | Level 12

If the wt05_count macro variable has been deleted in the subjob, or

if the wt05_count macro variable has been created in the subjob, then

it has become a local macro variable.

 

If it's the former, check the symdel and %symdel statements, and if it's the latter, try putting 

%global wt05_count;

in front of the proc sql.

sathya66
Barite | Level 11
Tried this
but no luck %global wt05_count;
let me test symdel and %symdel statements
japelin
Rhodochrosite | Level 12

symdel deletes a macro variable.

Try searching for "symdel" in subjob.
If you find it, make sure you haven't deleted wt05_count.

Tom
Super User Tom
Super User

That code looks wrong.  It looks like you are trying to create a variable in Teradata instead of a macro variable in SAS.

Also when using INTO clause of PROC SQL to make a macro variable it is best to first set some default value for the macro variable in case the query returns no observations. 

proc sql noprint;
  connect to teradata  ( user=myusr1 password=mypwd1 );
%let wt05_count=QUERY FAILURE;
  select count into :wt05_count  from connection to teradata 
    (select count(*) as count from test)
  ;
  disconnect from teradata;
quit;
%put &wt05_count
sathya66
Barite | Level 11
If we run only that trnasormation , it is resolving but with whole job it's not

only run transformation -> It runs fine, and macro is resolved fine
Then run the whole job again -> It runs fine
Now close the job, open it again and run the whole job -> Same with a warning
sathya66
Barite | Level 11

also Just tried with simple proc sql and it didn't work.

libname test teradata AUTHDOMAIN="TeradataAuth" database=test fastload=yes;
proc sql noprint ;

select count(*) as count into:wt05_count from test.test;

quit;

I added a dummy job and run the code worked fine. If I add this subjob and Getting the warning. I think, the problem is with subjob.

sathya66
Barite | Level 11
Recreated the main job , sub/inner job from scratch and working fine

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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