<?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: encode64 in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/encode64/m-p/890920#M43555</link>
    <description>&lt;P&gt;You haven't posted working code so it is hard to tell what you are trying to do here.&lt;/P&gt;
&lt;P&gt;To use data step statements, like CALL SYMPUTX() you need to have a data step.&lt;/P&gt;
&lt;P&gt;Move any macro code to before or after the data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You defined NEWSTRING as length 200.&amp;nbsp; You should not pass the trailing spaces to the PUT() function.&amp;nbsp; You need to use a format width that is long enough to encode all 200 of those characters.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let client_id=cl8z50x6hs18bjfhvaiayktqb;
%let client_secret=c34e0aj4uokasfbe9zcgtcbjurt451mxzufyph7x3svn8i0htylg7dr1at4e;

data _null_;
  length newString $200.;
  newString=cats("&amp;amp;client_id.",":","&amp;amp;client_secret.");
  call symputx('Basic_Auth',put(trim(newString),$base64x300.));
run;

%put &amp;amp;=Basic_Auth;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result&lt;/P&gt;
&lt;PRE&gt;423  %put &amp;amp;=Basic_Auth;
BASIC_AUTH=Y2w4ejUweDZoczE4YmpmaHZhaWF5a3RxYjpjMzRlMGFqNHVva2FzZmJlOXpjZ3RjYmp1cnQ0NTFteHp1ZnlwaDd4M3N2bjhpMGh0eWxnN2RyMWF0NGU=
&lt;/PRE&gt;
&lt;P&gt;Or you could just skip the data step code completely.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let basic_auth=%sysfunc(putc(&amp;amp;client_id:&amp;amp;client_secret,$base64x300.));
%put &amp;amp;=Basic_Auth;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 24 Aug 2023 21:49:21 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2023-08-24T21:49:21Z</dc:date>
    <item>
      <title>encode64</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/encode64/m-p/890918#M43553</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I am trying to convert some string using encode64 but it does not seem to work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;length newString $200.;
%let client_id=cl8z50x6hs18bjfhvaiayktqb;
%let client_secret=c34e0aj4uokasfbe9zcgtcbjurt451mxzufyph7x3svn8i0htylg7dr1at4e;
newString=cats("&amp;amp;client_id.",":","&amp;amp;client_secret.");
call symputx('Basic_Auth',put(newString,$base64x64.));
%put &amp;amp;=Basic_Auth;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Does someone know how to use this format&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2023 21:01:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/encode64/m-p/890918#M43553</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2023-08-24T21:01:13Z</dc:date>
    </item>
    <item>
      <title>Re: encode64</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/encode64/m-p/890919#M43554</link>
      <description>&lt;P&gt;When you say "it doesn't work" do you mean the result is not encoded, or that the API doesn't recognize it as valid?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's an example that I've used with a different API (Brightcove), but it may be similar to what Qualtrics needs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;data _null_;
length cred $ 128; 
 cred = "&amp;amp;client_id.:&amp;amp;client_secret.";
 call symputx('_bccred',put(trim(cred),$base64x256.));
run;&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 24 Aug 2023 21:08:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/encode64/m-p/890919#M43554</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2023-08-24T21:08:06Z</dc:date>
    </item>
    <item>
      <title>Re: encode64</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/encode64/m-p/890920#M43555</link>
      <description>&lt;P&gt;You haven't posted working code so it is hard to tell what you are trying to do here.&lt;/P&gt;
&lt;P&gt;To use data step statements, like CALL SYMPUTX() you need to have a data step.&lt;/P&gt;
&lt;P&gt;Move any macro code to before or after the data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You defined NEWSTRING as length 200.&amp;nbsp; You should not pass the trailing spaces to the PUT() function.&amp;nbsp; You need to use a format width that is long enough to encode all 200 of those characters.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let client_id=cl8z50x6hs18bjfhvaiayktqb;
%let client_secret=c34e0aj4uokasfbe9zcgtcbjurt451mxzufyph7x3svn8i0htylg7dr1at4e;

data _null_;
  length newString $200.;
  newString=cats("&amp;amp;client_id.",":","&amp;amp;client_secret.");
  call symputx('Basic_Auth',put(trim(newString),$base64x300.));
run;

%put &amp;amp;=Basic_Auth;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result&lt;/P&gt;
&lt;PRE&gt;423  %put &amp;amp;=Basic_Auth;
BASIC_AUTH=Y2w4ejUweDZoczE4YmpmaHZhaWF5a3RxYjpjMzRlMGFqNHVva2FzZmJlOXpjZ3RjYmp1cnQ0NTFteHp1ZnlwaDd4M3N2bjhpMGh0eWxnN2RyMWF0NGU=
&lt;/PRE&gt;
&lt;P&gt;Or you could just skip the data step code completely.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let basic_auth=%sysfunc(putc(&amp;amp;client_id:&amp;amp;client_secret,$base64x300.));
%put &amp;amp;=Basic_Auth;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 24 Aug 2023 21:49:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/encode64/m-p/890920#M43555</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-08-24T21:49:21Z</dc:date>
    </item>
  </channel>
</rss>

