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

hello,

 

%LET dte = %sysfunc(intnx(month, &today, -27));

 

i am running a  query with a pass  through connection and when  using 

where>'01Mar2015'd  everything looks fine but  if i use a macro variable

where>&dte then i get  the warning 'symbolic reference dte not being  resolved" which leads to an error

 

i also  tried to  double  qoute this macro var and again  the same  warning and  error

Any idea  why is this  happening?

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

You don't need the double quotes around &month_27

 

This macro variable is resolved for me in my application with my database and works as expected.

--
Paige Miller

View solution in original post

7 REPLIES 7
PaigeMiller
Diamond | Level 26

Does &today have a value?

--
Paige Miller
Tal
Pyrite | Level 9 Tal
Pyrite | Level 9

yes  it does  ,sorry

 

%LET today = %sysfunc(today());

PaigeMiller
Diamond | Level 26

Then we need to see a larger section of your code so we can understand the entire usage.

--
Paige Miller
Astounding
PROC Star

Without seeing more of your code, this is a shot in the dark.  Try adding a %GLOBAL statement before assigning a value to DTE:

 

%global dte;

%let dte = %sysfunc ...........;

Tal
Pyrite | Level 9 Tal
Pyrite | Level 9

 

%global  not working  either  😞

the code  works fine  if  i  use         tab2.CREATION_DATE >="01MAR2015"d but not if i use the macro var below  and it resolves fine everywhere out  of the  query but not in the  query below

 

 


%LET today = %sysfunc(today());
%LET month_27 = %sysfunc(intnx(month, &today, -27));

%put  &month_27;

 

CREATE TABLE clkb_base AS
SELECT x,y,z
 
FROM tab1
 JOIN tab2  ON tab1.ADDR_ENTITY_ID = tab2.CUSTOMER_ID
 JOIN tab3. ON tab1.ID = tab3.ENTITY_ID
  ........................
  .........................
WHERE  tab2.CREATION_DATE >="&month_27"
QUIT;

PaigeMiller
Diamond | Level 26

You don't need the double quotes around &month_27

 

This macro variable is resolved for me in my application with my database and works as expected.

--
Paige Miller
Tal
Pyrite | Level 9 Tal
Pyrite | Level 9

yea,i also tried  the same  code  on EG SAS and  works  but did not on PC SAS so definately not a  syntax issue

 

thank you

 

 

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 7 replies
  • 1087 views
  • 0 likes
  • 3 in conversation