<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: teradata -SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972937#M377602</link>
    <description>&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;Few questions please-&lt;/P&gt;
&lt;P&gt;1- If using In operator with spaces instead of commas- will it save run time?&lt;/P&gt;
&lt;P&gt;2-Create&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;libref&amp;nbsp; &amp;nbsp;instead of making NEW connection to Teradata-will it save run time?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;3-Regarding your question- yes, I need subset&amp;nbsp; of rows and few columns only.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Do you recommend me to do it directly in tera? and then how to transfer the data from tera to sas??&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Also it is not good idea because the program will run in futures automatically in sas and then I cannot go to tera directly...&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Aug 2025 05:19:32 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2025-08-20T05:19:32Z</dc:date>
    <item>
      <title>teradata -SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972916#M377594</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;In Data warehouse (Tera data ) there is a table that contain millions or rows (800 million rows) and many variables.&lt;/P&gt;
&lt;P&gt;I want to work with this table (a few columns and for specific dates) in SAS.&lt;/P&gt;
&lt;P&gt;Which code do you think will take less run time ??Option1 or option2?&lt;/P&gt;
&lt;P&gt;OR maybe there is another way that can take less run time?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA V0500_option1;
SET teradata.V0500_1_FINANCIAL_EVENT(KEEP=Agreement_Id  Event_Date  Start_Date  Event_Time  Type_Code
WHERE=(Event_Date&amp;gt;='01SERP2020'd AND Type_Code  IN  (11002,11004,11050,11024,31510,11005)    AND Agreement_Id ne  -1 
 ));
Run;



 
proc sql;  
connect to teradata (server=dwprod schema=DWP_vall authdomain=TeraDataAuth);
create table V0500_option2  as 
select * from connection to teradata
(
SELECT   distinct Agreement_Id,Event_Date,Start_Date,Event_Time,Type_Code
from V0500_1_FINANCIAL_EVENT
where Event_Date&amp;gt;= date '2020-09-01'    
      AND Type_Code  IN  (11002,11004,11050,11024,31510,11005)   
	  AND Agreement_Id ne  -1  
);
disconnect from teradata;
quit ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Aug 2025 21:00:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972916#M377594</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2025-08-19T21:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: teradata -SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972928#M377596</link>
      <description>&lt;P&gt;Typically your Option 2 Passthru should be quicker as you can be sure filtering happens in Teradata before downloading. However why are you using DISCRETE which will only slow processing? I never use this if I can avoid it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also how many rows do you expect from this query? Even if your query selects only 1% of the rows that is still 8 million and will take significant time to select and download to SAS. Do a COUNT(*) first to see how many rows will be downloaded.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Aug 2025 23:44:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972928#M377596</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2025-08-19T23:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: teradata -SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972929#M377597</link>
      <description>&lt;P&gt;Actually I think you have to use special instructions to Teradata if you DON'T want it to return the distinct observations.&amp;nbsp; At least you do when defining a TABLE.&amp;nbsp; Its normal mode of operation is pure SET logic.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Aug 2025 00:27:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972929#M377597</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-08-20T00:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: teradata -SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972930#M377598</link>
      <description>&lt;P&gt;Those two should be equivalent.&amp;nbsp; Unless you have a lot of duplicate observations that the DISTINCT keyword is eliminating since then there will be fewer observations to transfer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Personally I wouldn't bother to type the extra characters needed to use the WHERE= dataset option and would instead just use a WHERE statement.&amp;nbsp; The result is the same.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Plus when using SAS code instead of Teradata code you don't have to type all of those commas for the IN operator to work. Spaces will do just fine. That can make it much easier to use a macro variable to contain the list of values.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data V0500_option1;
  set teradata.V0500_1_FINANCIAL_EVENT(keep=Agreement_Id Event_Date Start_Date Event_Time Type_Code);
  where Event_Date&amp;gt;='01SEP2020'd
    and Type_Code IN (11002 11004 11050 11024 31510 11005)
    and Agreement_Id ne  -1 
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But the real savings will come from doing even more processing in the Teradata server. So what is it that you want to do with this subset of the data?&amp;nbsp; Perhaps you can summarize on the Teradata side and transfer even less information between the two servers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that some procs like PROC SUMMARY will automatically push some of the processing into the Teradata server.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also note that there is no need to make a NEW connection to Teradata.&amp;nbsp; Instead you re reuse the connection you made for the libref by using the CONNECT USING syntax in your SQL code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname mytd teradata ..... ;
proc sql;  
connect using mytd;
create table V0500_option2  as 
select * from connection to mytd
(select distinct Agreement_Id,Event_Date,Start_Date,Event_Time,Type_Code
 from V0500_1_FINANCIAL_EVENT
 where Event_Date&amp;gt;= date '2020-09-01'    
   and Type_Code IN (11002,11004,11050,11024,31510,11005)   
   and Agreement_Id ne -1  
);
quit ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Aug 2025 00:42:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972930#M377598</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-08-20T00:42:50Z</dc:date>
    </item>
    <item>
      <title>Re: teradata -SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972936#M377601</link>
      <description>&lt;P&gt;Sorry I dont understand,&lt;/P&gt;
&lt;P&gt;where is discrete? I dont see this word in my code, can you show me please how to change the code ?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;  
connect to teradata (server=dwprod schema=DWP_vall authdomain=TeraDataAuth);
create table V0500  as 
select * from connection to teradata
(
SELECT   distinct Agreement_Id,Event_Date,Start_Date,Event_Time,Type_Code
from V0500_1_FINANCIAL_EVENT
where Event_Date&amp;gt;= date '2020-09-01'    
      AND Type_Code  IN  (11002,11004,11050,11024,31510,11005)   
	  AND Agreement_Id ne  -1  
);
disconnect from teradata;
quit ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Aug 2025 05:05:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972936#M377601</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2025-08-20T05:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: teradata -SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972937#M377602</link>
      <description>&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;Few questions please-&lt;/P&gt;
&lt;P&gt;1- If using In operator with spaces instead of commas- will it save run time?&lt;/P&gt;
&lt;P&gt;2-Create&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;libref&amp;nbsp; &amp;nbsp;instead of making NEW connection to Teradata-will it save run time?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;3-Regarding your question- yes, I need subset&amp;nbsp; of rows and few columns only.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Do you recommend me to do it directly in tera? and then how to transfer the data from tera to sas??&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Also it is not good idea because the program will run in futures automatically in sas and then I cannot go to tera directly...&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Aug 2025 05:19:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972937#M377602</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2025-08-20T05:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: teradata -SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972939#M377603</link>
      <description>&lt;P&gt;I didnt understand -&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Personally I wouldn't bother to type the extra characters needed to use the WHERE= dataset option and would instead just use a WHERE statement.&amp;nbsp; The result is the same&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Aug 2025 05:39:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972939#M377603</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2025-08-20T05:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: teradata -SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972942#M377605</link>
      <description>&lt;OL&gt;
&lt;LI&gt;In SAS no, in TD, probably not either.&lt;/LI&gt;
&lt;LI&gt;The connection time is probably the least of your concerns. Data processing and movement are.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;The only difference between the two is the DISTINCT. If your TD setup is good this operation will go faster there compared to SAS (don't know your SAS setup either...).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you don't want the trouble of writing explicit pass through code, you could use SAS SQL, your query will be passed down automatically to TD.&lt;/P&gt;
&lt;P&gt;The most optimal (from performance perspective) is to store the result in TD and continue working there, but then it depends on your use case, what you intend to do with the data next.&lt;/P&gt;
&lt;P&gt;If you wish to optimize the query further, speak with your TD DBA to see if anything can be done in TD.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Aug 2025 06:59:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972942#M377605</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2025-08-20T06:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: teradata -SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972978#M377618</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;Few questions please-&lt;/P&gt;
&lt;P&gt;1- If using In operator with spaces instead of commas- will it save run time?&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;No. Just reduce user frustration in typing, editing and reading the code.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2-Create&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;libref&amp;nbsp; &amp;nbsp;instead of making NEW connection to Teradata-will it save run time?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Minimally.&amp;nbsp; You can skip the time it takes to make a new connection.&amp;nbsp; It will make you program easier to maintain since there will only be one place where you have to place your signon information.&amp;nbsp; The Teradata DBA will probably be happier with you for putting less burden on their system.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;3-Regarding your question- yes, I need subset&amp;nbsp; of rows and few columns only.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;That was not the question. The question is WHY do you need the subset? What do you intend to do with it next? If the next step is something that would reduce the size of the data then doing that step inside of Teradata will save a lot of data transfer.&amp;nbsp; Transferring the data is what takes the most time.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Do you recommend me to do it directly in tera? and then how to transfer the data from tera to sas??&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Also it is not good idea because the program will run in futures automatically in sas and then I cannot go to tera directly...&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Not sure what that means.&amp;nbsp; If the data is in Teradata then you will always have to go to Teradata to get the data.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Aug 2025 13:17:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972978#M377618</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-08-20T13:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: teradata -SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972979#M377619</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I didnt understand -&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Personally I wouldn't bother to type the extra characters needed to use the WHERE= dataset option and would instead just use a WHERE statement.&amp;nbsp; The result is the same&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The code should work the same.&amp;nbsp; It is just more confusing and difficult for the programmer to have to type the extra () and = and make sure the nesting of the () are properly placed.&amp;nbsp; It also leads to extremely long statements that also make the code hard to type, edit and understand.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Aug 2025 13:20:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972979#M377619</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-08-20T13:20:22Z</dc:date>
    </item>
    <item>
      <title>Re: teradata -SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972981#M377621</link>
      <description>Thanks. &lt;BR /&gt;I use it later to merge it with sas data sets so I must stay in sas platform. &lt;BR /&gt;</description>
      <pubDate>Wed, 20 Aug 2025 15:23:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972981#M377621</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2025-08-20T15:23:43Z</dc:date>
    </item>
    <item>
      <title>Re: teradata -SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972991#M377623</link>
      <description>&lt;P&gt;What did your tests reveal?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Keep in mind that nobody here has an exact copy of your environment, so&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;you&lt;/EM&gt;&lt;/STRONG&gt; are the best source of information about relative performance.&lt;/P&gt;
&lt;P&gt;As always, Maxim 4.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a side note, why do you use DISTINCT in the pass-through? If it's not absolutely necessary, it's only a performance drain.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Aug 2025 16:54:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972991#M377623</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2025-08-20T16:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: teradata -SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972994#M377624</link>
      <description>Sometimes there are some problems in data and have duplications. Is it better to select all rows in the query that create sas data set from tera table  (not using distinct) and only then use sas proc sort nodupkey?</description>
      <pubDate>Wed, 20 Aug 2025 19:34:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972994#M377624</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2025-08-20T19:34:31Z</dc:date>
    </item>
    <item>
      <title>Re: teradata -SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972995#M377625</link>
      <description>&lt;P&gt;The distinct caused to the most of the problem!&lt;/P&gt;
&lt;P&gt;I took out distinct and then it run very quickly&lt;/P&gt;
&lt;P&gt;with distinct it took so long time and I stopped it&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Aug 2025 19:48:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972995#M377625</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2025-08-20T19:48:56Z</dc:date>
    </item>
    <item>
      <title>Re: teradata -SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972996#M377626</link>
      <description>&lt;P&gt;Apologies, I meant DISTINCT. No doubt you've realised that now.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Aug 2025 19:51:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972996#M377626</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2025-08-20T19:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: teradata -SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972997#M377627</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Sometimes there are some problems in data and have duplications. Is it better to select all rows in the query that create sas data set from tera table (not using distinct) and only then use sas proc sort nodupkey?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I think the point&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;was trying to make is that eliminating the duplicates can take time.&amp;nbsp; &amp;nbsp;That is especially true of a system like Teradata that tries to split the task across multiple modules running in parallel.&amp;nbsp; To eliminate the duplicates it would need to have those modules communicate, thus reducing some (or all) of the performance gained by splitting up the task,&amp;nbsp;&lt;STRONG&gt;even when there are no duplicates to be eliminated.&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if you know there will not be duplicates then do not use the DISTINCT keyword so that Teradata knows it does not have to worry about eliminating them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which is better depends on the performance of the two systems.&amp;nbsp; But in general I would say if eliminating duplicates reduces the number of observations that need to move from Teradata to SAS then it is probably worth asking Teradata to do it.&amp;nbsp; You could ask your local Teradata DBA for help with finding the best Teradata code to use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Aug 2025 19:53:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/972997#M377627</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-08-20T19:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: teradata -SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/973001#M377628</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Sometimes there are some problems in data and have duplications. Is it better to select all rows in the query that create sas data set from tera table (not using distinct) and only then use sas proc sort nodupkey?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That's what I would do; PROC SORT in SAS is usually the quickest way, unless you can fit the data into memory (hash object).&lt;/P&gt;</description>
      <pubDate>Wed, 20 Aug 2025 20:32:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/teradata-SAS/m-p/973001#M377628</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2025-08-20T20:32:30Z</dc:date>
    </item>
  </channel>
</rss>

