<?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: translating a Microsoft Access SQL query to A SAS Proc SQL query in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/401275#M97342</link>
    <description>&lt;P&gt;I would question why you have to do this multiple times.&amp;nbsp; Anyways how about a small macro to do it (not tested):&lt;/P&gt;
&lt;PRE&gt;%macro TranL (inds=,outds=,lvar=);

  data &amp;amp;outds.;
    set &amp;amp;inds.;
    array varlist &amp;amp;lvar.;
    do over varlist;
      varlist=translate(varlist,&lt;SPAN&gt;'AAAAAAAAAAA','ÀÁÂÃÄÅÆĀĂĄǍ');&lt;/SPAN&gt;
      varlist=translate(varlist,&lt;SPAN&gt;'IIIIIIIIII' , 'ÌÍÎÏĨĪĬĮİǏ');&lt;BR /&gt;&lt;/SPAN&gt;      ...
    end;
  run;

%mend TranL;

%TranL (inds=tre,outds=due,lvar=nomenew3 cognomenew3);
%TranL (inds=tre,outds=tre1,lvar=...);&lt;/PRE&gt;</description>
    <pubDate>Thu, 05 Oct 2017 10:31:40 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-10-05T10:31:40Z</dc:date>
    <item>
      <title>translating a Microsoft Access SQL query to A SAS Proc SQL query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/401249#M97334</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I want to use TRANSLATE&amp;nbsp; in more than one lines in the program (see example1) but the instruction doesn’t work. I works only if I write one line at a time. Is it correct?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do I have to split each time for different dataset&amp;nbsp; and write one instruction at a time such Example 2? Is there a way to write all the instruction together?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;Stefy67&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example1:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; tre;&lt;/P&gt;&lt;P&gt;set due;&lt;/P&gt;&lt;P&gt;nomenew3 = translate(nomenew2,'AAAAAAAAAAA','ÀÁÂÃÄÅÆĀĂĄǍ');&lt;/P&gt;&lt;P&gt;cognomenew3 = translate(cognomenew2,'AAAAAAAAAAA','ÀÁÂÃÄÅÆĀĂĄǍ');&lt;/P&gt;&lt;P&gt;nomenew3 = translate(nomenew2, 'IIIIIIIIII' , 'ÌÍÎÏĨĪĬĮİǏ');&lt;BR /&gt;nomenew3 = translate(nomenew2, 'OOOOOOOOO' , 'ÒÓÔÕÖŌŎŐǑ');&lt;/P&gt;&lt;P&gt;cognomenew3 = translate(cognomenew2, 'IIIIIIIIII' , 'ÌÍÎÏĨĪĬĮİǏ');&lt;BR /&gt;cognomenew3 = translate(cognomenew2, 'OOOOOOOOO' , 'ÒÓÔÕÖŌŎŐǑ');&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Example2:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;tre;&lt;/P&gt;&lt;P&gt;set due;&lt;/P&gt;&lt;P&gt;nomenew3 = translate(nomenew2,'AAAAAAAAAAA','ÀÁÂÃÄÅÆĀĂĄǍ'); run;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;tre1;&lt;/P&gt;&lt;P&gt;set &lt;SPAN&gt;tre&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;cognomenew3 = translate(cognomenew2,'AAAAAAAAAAA','ÀÁÂÃÄÅÆĀĂĄǍ'); run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2017 09:27:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/401249#M97334</guid>
      <dc:creator>Stefy67</dc:creator>
      <dc:date>2017-10-05T09:27:02Z</dc:date>
    </item>
    <item>
      <title>Re: translating a Microsoft Access SQL query to A SAS Proc SQL query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/401275#M97342</link>
      <description>&lt;P&gt;I would question why you have to do this multiple times.&amp;nbsp; Anyways how about a small macro to do it (not tested):&lt;/P&gt;
&lt;PRE&gt;%macro TranL (inds=,outds=,lvar=);

  data &amp;amp;outds.;
    set &amp;amp;inds.;
    array varlist &amp;amp;lvar.;
    do over varlist;
      varlist=translate(varlist,&lt;SPAN&gt;'AAAAAAAAAAA','ÀÁÂÃÄÅÆĀĂĄǍ');&lt;/SPAN&gt;
      varlist=translate(varlist,&lt;SPAN&gt;'IIIIIIIIII' , 'ÌÍÎÏĨĪĬĮİǏ');&lt;BR /&gt;&lt;/SPAN&gt;      ...
    end;
  run;

%mend TranL;

%TranL (inds=tre,outds=due,lvar=nomenew3 cognomenew3);
%TranL (inds=tre,outds=tre1,lvar=...);&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Oct 2017 10:31:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/401275#M97342</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-10-05T10:31:40Z</dc:date>
    </item>
    <item>
      <title>Re: translating a Microsoft Access SQL query to A SAS Proc SQL query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/401278#M97343</link>
      <description>Thanks a lot&lt;BR /&gt;&lt;BR /&gt;But I want more varlist=translate ....... in one dataset 'outs' and not many 'outds' (ex. Due, tre1, ...)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 05 Oct 2017 10:40:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/401278#M97343</guid>
      <dc:creator>Stefy67</dc:creator>
      <dc:date>2017-10-05T10:40:35Z</dc:date>
    </item>
    <item>
      <title>Re: translating a Microsoft Access SQL query to A SAS Proc SQL query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/401280#M97345</link>
      <description>&lt;P&gt;"Does not work" can be the result of anything. So, please post input data as datastep, and full log output and describe what you expected to happen.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2017 11:04:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/401280#M97345</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2017-10-05T11:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: translating a Microsoft Access SQL query to A SAS Proc SQL query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/401281#M97346</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Well, the function basechar should get you a fairways to what you want:&lt;/P&gt;
&lt;PRE&gt;data dec;
  length code $200;
  input code $;
  want_string=basechar(code);
datalines;
AÀÁZÂÃÄÅÆĀĂĄǍ
ÌIÍÎIÏĨĪĬĮİǏ
;
run;&lt;/PRE&gt;
&lt;P&gt;It will not get all of them, depending on your encoding.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The other way is to step through each character at a time, using the char(&amp;lt;string&amp;gt;,&amp;lt;pos&amp;gt;) function, and split out the multi-byte characters and replace that way.&amp;nbsp; This shows what each of the characters byte numbers are - you will note on the special characters they have two, a table number and code within that table.&amp;nbsp; If you know the sequence you can then search for the various table numbers and the series of characters and replace with a given base table number.&lt;/P&gt;
&lt;PRE&gt;data dec;
  length code $200;
  input code $;
  array cs{30};
  do i=1 to lengthn(code);
    cs{i}=rank(char(code,i));
  end;
datalines;
AÀÁZÂÃÄÅÆĀĂĄǍ
ÌIÍÎIÏĨĪĬĮİǏ
;
run;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;This page might be useful to you:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://documentation.sas.com/?cdcId=vdmmlcdc&amp;amp;cdcVersion=8.1&amp;amp;docsetId=nlsref&amp;amp;docsetTarget=p1pca7vwjjwucin178l8qddjn0gi.htm&amp;amp;locale=en" target="_blank"&gt;http://documentation.sas.com/?cdcId=vdmmlcdc&amp;amp;cdcVersion=8.1&amp;amp;docsetId=nlsref&amp;amp;docsetTarget=p1pca7vwjjwucin178l8qddjn0gi.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2017 11:13:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/translating-a-Microsoft-Access-SQL-query-to-A-SAS-Proc-SQL-query/m-p/401281#M97346</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-10-05T11:13:57Z</dc:date>
    </item>
  </channel>
</rss>

