<?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 how to specify wich .tks3.conf file to use with a pipe command in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-specify-wich-tks3-conf-file-to-use-with-a-pipe-command/m-p/950603#M45510</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using the following sas code to get the directory listing&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro FindingMasterListPolicyName(env);

%let filelist=/&amp;amp;path1./s3filestodownload.txt;

/***** Selecting the good s3 bucket path according to the environment selected *****/

%if       &amp;amp;env eq dev  %then %let s3bucketpath=s3://dev-pr-brz-datareten-edp-nprod;
%else %if &amp;amp;env eq intg %then %let s3bucketpath=s3://intg-pr-brz-datareten-edp-nprod;
%else %if &amp;amp;env eq uat  %then %let s3bucketpath=s3://uat-pr-brz-datareten-edp-nprod;

%put &amp;amp;=env  &amp;amp;=s3bucketpath;
/*********************************************************************************/

filename oscmd pipe "aws s3 ls ""&amp;amp;s3bucketpath."" --recursive | grep .csv ";

data foldercontents2 ;
length text $2000. fnameandpath $200.;
infile oscmd;
input;
text=_infile_;
run;

data foldercontents2 (drop=text);
set foldercontents2 ;
creationdate=scan(text,1,' ');
creationtime=scan(text,2,' ');
filesize=scan(text,3,' ');
fnameandpath =scan(text,1," ","b");
FName =scan(text,1,"/","b");
path=substr(fnameandpath,1,length(fnameandpath)-length(FName)- 1);
where find(text,'MASTER_LIST') &amp;gt; 0 AND find(text,'_Policy_') &amp;gt; 0 AND find(text,'ARCHIVE') = 0;
run;

proc sort data=foldercontents2 out=foldercontents;
by creationdate creationtime FName;
run;


/*** Getting the path and file name of the Master List to download ***/
Data _null_;
set foldercontents;
if _n_ = 1  then 
do; 
	call symputx('MasterListName',Fname,'g');
    call symputx('masterlistfilepath',Path,'g');
end;
run;
%put &amp;amp;=masterlistfilepath. &amp;amp;=MasterListName.;

%goto exit;

filename filelist "&amp;amp;filelist";
data _null_;
FILE filelist LRECL=150 recfm=v;
put "&amp;amp;masterlistfilepath./&amp;amp;MasterListName.";
;
run;
%exit: %mend FindingMasterListPolicyName;
%FindingMasterListPolicyName(dev);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I have three conf file:&lt;/P&gt;
&lt;P&gt;one in /home/dev/.tks3.conf&lt;/P&gt;
&lt;P&gt;another one in / home/intg/tks3.conf&lt;/P&gt;
&lt;P&gt;and another one in /home/uat/.tks3.conf&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;how to specify which one to use with the above pipe command ?&lt;/P&gt;</description>
    <pubDate>Wed, 13 Nov 2024 16:23:06 GMT</pubDate>
    <dc:creator>alepage</dc:creator>
    <dc:date>2024-11-13T16:23:06Z</dc:date>
    <item>
      <title>how to specify wich .tks3.conf file to use with a pipe command</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-specify-wich-tks3-conf-file-to-use-with-a-pipe-command/m-p/950603#M45510</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using the following sas code to get the directory listing&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro FindingMasterListPolicyName(env);

%let filelist=/&amp;amp;path1./s3filestodownload.txt;

/***** Selecting the good s3 bucket path according to the environment selected *****/

%if       &amp;amp;env eq dev  %then %let s3bucketpath=s3://dev-pr-brz-datareten-edp-nprod;
%else %if &amp;amp;env eq intg %then %let s3bucketpath=s3://intg-pr-brz-datareten-edp-nprod;
%else %if &amp;amp;env eq uat  %then %let s3bucketpath=s3://uat-pr-brz-datareten-edp-nprod;

%put &amp;amp;=env  &amp;amp;=s3bucketpath;
/*********************************************************************************/

filename oscmd pipe "aws s3 ls ""&amp;amp;s3bucketpath."" --recursive | grep .csv ";

data foldercontents2 ;
length text $2000. fnameandpath $200.;
infile oscmd;
input;
text=_infile_;
run;

data foldercontents2 (drop=text);
set foldercontents2 ;
creationdate=scan(text,1,' ');
creationtime=scan(text,2,' ');
filesize=scan(text,3,' ');
fnameandpath =scan(text,1," ","b");
FName =scan(text,1,"/","b");
path=substr(fnameandpath,1,length(fnameandpath)-length(FName)- 1);
where find(text,'MASTER_LIST') &amp;gt; 0 AND find(text,'_Policy_') &amp;gt; 0 AND find(text,'ARCHIVE') = 0;
run;

proc sort data=foldercontents2 out=foldercontents;
by creationdate creationtime FName;
run;


/*** Getting the path and file name of the Master List to download ***/
Data _null_;
set foldercontents;
if _n_ = 1  then 
do; 
	call symputx('MasterListName',Fname,'g');
    call symputx('masterlistfilepath',Path,'g');
end;
run;
%put &amp;amp;=masterlistfilepath. &amp;amp;=MasterListName.;

%goto exit;

filename filelist "&amp;amp;filelist";
data _null_;
FILE filelist LRECL=150 recfm=v;
put "&amp;amp;masterlistfilepath./&amp;amp;MasterListName.";
;
run;
%exit: %mend FindingMasterListPolicyName;
%FindingMasterListPolicyName(dev);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I have three conf file:&lt;/P&gt;
&lt;P&gt;one in /home/dev/.tks3.conf&lt;/P&gt;
&lt;P&gt;another one in / home/intg/tks3.conf&lt;/P&gt;
&lt;P&gt;and another one in /home/uat/.tks3.conf&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;how to specify which one to use with the above pipe command ?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 16:23:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-specify-wich-tks3-conf-file-to-use-with-a-pipe-command/m-p/950603#M45510</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2024-11-13T16:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: how to specify wich .tks3.conf file to use with a pipe command</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-specify-wich-tks3-conf-file-to-use-with-a-pipe-command/m-p/950618#M45511</link>
      <description>&lt;P&gt;Not really a SAS question.&lt;/P&gt;
&lt;P&gt;You are using this operating system command to get the list of files.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;aws s3&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The AWS command has a command line option to specify which profile you want it to use.&amp;nbsp; From the command line on your host run this command&lt;/P&gt;
&lt;PRE&gt;aws help&lt;/PRE&gt;
&lt;P&gt;to see the help information for the aws command.&amp;nbsp; You will see:&lt;/P&gt;
&lt;PRE&gt;      --profile (string)

       Use a specific profile from your credential file.

&lt;/PRE&gt;
&lt;P&gt;So create profiles in you credential file for your three environments. You might make profiles named with the same values as you pass in the ENV macro variable so that the only change you need to make is:&lt;/P&gt;
&lt;PRE&gt;aws --profile &amp;amp;env ls &lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Nov 2024 17:29:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-specify-wich-tks3-conf-file-to-use-with-a-pipe-command/m-p/950618#M45511</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-11-13T17:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: how to specify the profile with a pipe command</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-specify-wich-tks3-conf-file-to-use-with-a-pipe-command/m-p/950705#M45513</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename oscmd pipe "aws s3 ls   &amp;amp;s3bucketpath. --profile &amp;amp;profile. --recursive | grep .csv ";

data foldercontents2 ;
length text $2000.;
infile oscmd;
input;
text=_infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You also need to go in your home directory /.aws/credentials&lt;/P&gt;
&lt;P&gt;and in that credentials file, you add all your profiles as below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[default]&lt;BR /&gt;aws_access_key_id = value&lt;BR /&gt;aws_secret_access_key = value&lt;BR /&gt;region = ca-central-1&lt;BR /&gt;[profile name1]&lt;BR /&gt;aws_access_key_id=value&lt;BR /&gt;aws_secret_access_key=value&lt;BR /&gt;region = ca-central-1&lt;BR /&gt;aws_session_token=value&lt;BR /&gt;[profile name2]&lt;BR /&gt;aws_access_key_id=value&lt;BR /&gt;aws_secret_access_key=value&lt;BR /&gt;region = ca-central-1&lt;BR /&gt;aws_session_token=value&lt;/P&gt;
&lt;P&gt;[profile name3]&lt;BR /&gt;aws_access_key_id=value&lt;BR /&gt;aws_secret_access_key=value&lt;BR /&gt;region = ca-central-1&lt;BR /&gt;aws_session_token=value&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2024 21:05:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-specify-wich-tks3-conf-file-to-use-with-a-pipe-command/m-p/950705#M45513</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2024-11-13T21:05:52Z</dc:date>
    </item>
  </channel>
</rss>

