<?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 R function in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/R-function-in-SAS/m-p/618710#M181536</link>
    <description>&lt;P&gt;&lt;BR /&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to convert R code to SAS using Proc SQL, The function concat and collectlist&amp;nbsp; could not be located.&lt;/P&gt;&lt;P&gt;I need help in finding an alternative function or code for this R code in SAS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;example:&lt;/P&gt;&lt;P&gt;variable: XXXX-XXXXX&lt;/P&gt;&lt;P&gt;XXX,&lt;/P&gt;&lt;P&gt;XXX-XXXX-XXXX,&lt;/P&gt;&lt;P&gt;XXXXX,&lt;/P&gt;&lt;P&gt;NULL, (blanks) ETC&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;VARIABLE 2:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;example: ( i think length is 12, i cant check since its million records)&lt;/P&gt;&lt;P&gt;XX0000X25X82&lt;/P&gt;&lt;P&gt;XX9001402331&lt;/P&gt;&lt;P&gt;XXX3XX3I01X8&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Given R code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*concat_ws(',', COLLECT_LIST(distinct coalesce(variable,'')) ) as var1, */&lt;/P&gt;&lt;P&gt;//*concat_ws(',', COLLECT_LIST(distinct substr(coalesce(variable2,'99'),1,2)) ) as var2,*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Need SAS code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for checking&lt;/P&gt;</description>
    <pubDate>Mon, 20 Jan 2020 21:55:13 GMT</pubDate>
    <dc:creator>Kalai2008</dc:creator>
    <dc:date>2020-01-20T21:55:13Z</dc:date>
    <item>
      <title>R function in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/R-function-in-SAS/m-p/618710#M181536</link>
      <description>&lt;P&gt;&lt;BR /&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to convert R code to SAS using Proc SQL, The function concat and collectlist&amp;nbsp; could not be located.&lt;/P&gt;&lt;P&gt;I need help in finding an alternative function or code for this R code in SAS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;example:&lt;/P&gt;&lt;P&gt;variable: XXXX-XXXXX&lt;/P&gt;&lt;P&gt;XXX,&lt;/P&gt;&lt;P&gt;XXX-XXXX-XXXX,&lt;/P&gt;&lt;P&gt;XXXXX,&lt;/P&gt;&lt;P&gt;NULL, (blanks) ETC&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;VARIABLE 2:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;example: ( i think length is 12, i cant check since its million records)&lt;/P&gt;&lt;P&gt;XX0000X25X82&lt;/P&gt;&lt;P&gt;XX9001402331&lt;/P&gt;&lt;P&gt;XXX3XX3I01X8&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Given R code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*concat_ws(',', COLLECT_LIST(distinct coalesce(variable,'')) ) as var1, */&lt;/P&gt;&lt;P&gt;//*concat_ws(',', COLLECT_LIST(distinct substr(coalesce(variable2,'99'),1,2)) ) as var2,*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Need SAS code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for checking&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2020 21:55:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/R-function-in-SAS/m-p/618710#M181536</guid>
      <dc:creator>Kalai2008</dc:creator>
      <dc:date>2020-01-20T21:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: R function in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/R-function-in-SAS/m-p/618720#M181543</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/86703"&gt;@Kalai2008&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to convert R code to SAS using Proc SQL, The function concat and collectlist&amp;nbsp; could not be located.&lt;/P&gt;
&lt;P&gt;I need help in finding an alternative function or code for this R code in SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Could you describe for us what the functions CONCAT and COLLECTLIST do? There is no such concept as a LIST in SAS (except in PROC IML).&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2020 22:50:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/R-function-in-SAS/m-p/618720#M181543</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-01-20T22:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: R function in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/R-function-in-SAS/m-p/618722#M181544</link>
      <description>&lt;P&gt;Take a look at the car family of functions (e.g.&amp;nbsp;&lt;/P&gt;
&lt;H1 class="super_title_1    center"&gt;CAT, CATT, CATS and CATX )&lt;/H1&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2020 23:27:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/R-function-in-SAS/m-p/618722#M181544</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2020-01-20T23:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: R function in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/R-function-in-SAS/m-p/618932#M181634</link>
      <description>&lt;P&gt;I have to say that I can't tell what your starting values or the associated desired output is for a given input value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In general with SAS a variable holds a single value per observation (or record if you prefer). So if dealing with multiple values you either have multiple observations or multiple variables in SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It would help if you could show your example of starting SAS data and what the result would look like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have a SAS data set Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Only include the variables/ observations needed to demonstrate the input and the associated output for that example input.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 19:11:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/R-function-in-SAS/m-p/618932#M181634</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-01-21T19:11:01Z</dc:date>
    </item>
    <item>
      <title>Re: R function in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/R-function-in-SAS/m-p/619042#M181674</link>
      <description>&lt;P&gt;The&lt;FONT face="courier new,courier"&gt; collect_list&lt;/FONT&gt; function looks like one of the non-existing &lt;A href="https://communities.sas.com/t5/SASware-Ballot-Ideas/create-string-summary-functions/idi-p/288035" target="_self"&gt;SAS SQL string summary functions&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 05:59:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/R-function-in-SAS/m-p/619042#M181674</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-01-22T05:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: R function in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/R-function-in-SAS/m-p/619044#M181675</link>
      <description>&lt;P&gt;In the meantime, and if you insist on using SQL, this may help:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;

  select distinct quote(coalesce(substr(VAR1, 1, 2), '99')) into :var1list separated by ','
  from TAB1;

  create table TAB2 as
  select catx(',', &amp;amp;var1list) as VAR2
       , etc



&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Jan 2020 06:16:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/R-function-in-SAS/m-p/619044#M181675</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-01-22T06:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: R function in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/R-function-in-SAS/m-p/619413#M181845</link>
      <description>&lt;P&gt;Or even:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;

  select distinct coalesce(substr(VAR1, 1, 2), '99') into :var1list separated by ','
  from TAB1;

  create table TAB2 as
  select "&amp;amp;var1list" as VAR2
       , etc
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 05:41:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/R-function-in-SAS/m-p/619413#M181845</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-01-23T05:41:59Z</dc:date>
    </item>
  </channel>
</rss>

