BookmarkSubscribeRSS Feed
santosh_pat69
Quartz | Level 8

Hi All,

 

 

I am trying to extract data from teradata.

i am using Pass thru to do this, i need to extract only the records which have an expiry date greater than today.

 

I have created a Macro variable tdy, as this code needs to be run daily only the stores keeps changing.

 

Where a. Exp_date > &tdy. and Sales GT 500 and Store_loc in ('xxxxx','yyyyy','oooo','zzzz');

 

but i am getting more records when i am extracting  the data using SAS pass thru facility but when i run the similar query on Teradata

i get less number of records .

 

Where a. Exp_date > Current_date  and Sales GT 500 and Store_loc in ('xxxxx','yyyyy','oooo','zzzz');

 

And also i need to pass few Store names  in the Where clause as shown in the above where clause. i am planning to do this by passing the comma separated macro variables.

 

I have already read in the stores details in a comma separated macro variable but i am struggling to get this macro variable in.

 

Any suggestion or guidance is helpful.

 

 

 

 

 

 

 

 

 

 

3 REPLIES 3
Patrick
Opal | Level 21

Post your code and log if available. Make sure you also post the bit which shows us to what the macro variables you're using in your code resolve.

 

LinusH
Tourmaline | Level 20
"Similar"? Explicit pass thru means that you actually are executing within teradata.
It seems you have a simple filter which means you don't gain anything by doing an explicit pass through.
Data never sleeps
santosh_pat69
Quartz | Level 8
Hi All,

Thank you for the suggestions, I was trying to compare the Dates in Teradata and SAS
I have figured out this and it is working for me.
Where Cast(Sales_date as date) > %unquote(%str(%'&td.'%)) ;
Here I have read the &td consists of todays date (&sysdate) in the desired format.

Thanks
Santosh

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!

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