BookmarkSubscribeRSS Feed
deleted_user
Not applicable
This is the log of mmy code which does not give an error but still if I try to reference the value n_lcg I get an error that the value cannot be resolved.
How do I resove this error?


213 PROC SQL STIMER noprint;
NOTE: SQL Statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds

214 CONNECT TO &tera;
NOTE: SQL Statement used (Total process time):
real time 0.38 seconds
cpu time 0.02 seconds

215 create table cnt_lcg as
216 select * from CONNECTION TO teradata
217 (select count(*) as cnt from user_wrk.sa_lgc );
NOTE: Table WORK.CNT_LCG created, with 1 rows and 1 columns.

NOTE: SQL Statement used (Total process time):
real time 19.53 seconds
cpu time 0.00 seconds

218
235 select cnt into :n_lcg from cnt_lcg;
NOTE: SQL Statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds

245 disconnect from teradata;
NOTE: SQL Statement used (Total process time):
real time 0.07 seconds
cpu time 0.01 seconds

246 quit;
NOTE: PROCEDURE SQL used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds


%macro check_n;
108 /*%if %eval(&n_lcg) = 0 %then %do;
109 %let err=No Records in sa_lgc;
110 %job_log(id=&job_id,job_nm=JOB1,remark=&err,m_id=WAP,stat=Complete);
111
112 %put endsas1;
113 %end;*/

WARNING: Apparent symbolic reference N_lcg not resolved.

Thank you!
2 REPLIES 2
ArtC
Rhodochrosite | Level 12
We are not seeing all of your program. Specifically you have not shown us the full definition of the macro CHECK_N (which currently has all the shown code commented out). Nor do we see where or how the macro variable N_LCG is called.

Consider using a %PUT N_LCG &N_LCG; statement to verify that the macro variable exists and has a value.
PatrickG
SAS Employee
My guess is that this is a "timing" thing. The warning is likely coming during the compilation of the %check_n macro which occurs before execution time (when your PROC SQL runs).

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1861 views
  • 0 likes
  • 3 in conversation