DATA Step, Macro, Functions and more

extract from teradata

Posts: 66

extract from teradata

[ Edited ]

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.











Respected Advisor
Posts: 4,736

Re: extract from teradata

Posted in reply to santosh_pat69

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.


Super User
Posts: 5,878

Re: extract from teradata

Posted in reply to santosh_pat69
"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
Posts: 66

Re: extract from teradata

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.

Ask a Question
Discussion stats
  • 3 replies
  • 3 in conversation