<?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 Looking for equivalent function is SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Looking-for-equivalent-function-is-SAS/m-p/825880#M326205</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Please let me know the equivalent function for string_agg&amp;nbsp; (which is generally used in SQL Server)&amp;nbsp;in SAS.&amp;nbsp;It is being used in SQL Server as:-&amp;nbsp;Sting_Agg(Variable_Name,';'). Where Variable_Name is any variable in sas and ; is separator. PFB, is the clear picture of how it works&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="string_agg-how-it-works.jpg" style="width: 844px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73834i11A088F77F46F525/image-size/large?v=v2&amp;amp;px=999" role="button" title="string_agg-how-it-works.jpg" alt="string_agg-how-it-works.jpg" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 28 Jul 2022 10:53:05 GMT</pubDate>
    <dc:creator>dewanganrahul</dc:creator>
    <dc:date>2022-07-28T10:53:05Z</dc:date>
    <item>
      <title>Looking for equivalent function is SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looking-for-equivalent-function-is-SAS/m-p/825880#M326205</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Please let me know the equivalent function for string_agg&amp;nbsp; (which is generally used in SQL Server)&amp;nbsp;in SAS.&amp;nbsp;It is being used in SQL Server as:-&amp;nbsp;Sting_Agg(Variable_Name,';'). Where Variable_Name is any variable in sas and ; is separator. PFB, is the clear picture of how it works&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="string_agg-how-it-works.jpg" style="width: 844px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73834i11A088F77F46F525/image-size/large?v=v2&amp;amp;px=999" role="button" title="string_agg-how-it-works.jpg" alt="string_agg-how-it-works.jpg" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2022 10:53:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looking-for-equivalent-function-is-SAS/m-p/825880#M326205</guid>
      <dc:creator>dewanganrahul</dc:creator>
      <dc:date>2022-07-28T10:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for equivalent function is SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looking-for-equivalent-function-is-SAS/m-p/825881#M326206</link>
      <description>&lt;P&gt;You could run PROC TRANSPOSE on the variable COLUMN1 to make all the data values in one row, then use the &lt;A href="https://documentation.sas.com/doc/en/pgmmvacdc/9.4/lefunctionsref/n0p7wxtk0hvn83n1pveisbcp2ae9.htm" target="_self"&gt;CATX function&lt;/A&gt; to perform the string manipulation desired.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;UNTESTED CODE&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=have out=have_t;
     var column1;
run;
data want;
     set have_t;
     desired_string = catx('-',of col:);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Jul 2022 10:57:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looking-for-equivalent-function-is-SAS/m-p/825881#M326206</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-07-28T10:57:03Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for equivalent function is SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looking-for-equivalent-function-is-SAS/m-p/825882#M326207</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp; Can you please provide the solution which can be written under PROC SQL? Since, I am converting the SQL Server queries to PROC SQL code in SAS. FYI: I am writing in the SELECT CLAUSE.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2022 11:05:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looking-for-equivalent-function-is-SAS/m-p/825882#M326207</guid>
      <dc:creator>dewanganrahul</dc:creator>
      <dc:date>2022-07-28T11:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for equivalent function is SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looking-for-equivalent-function-is-SAS/m-p/825884#M326209</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/56602"&gt;@dewanganrahul&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp; Can you please provide the solution which can be written under PROC SQL?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;No, I can't and I'm not sure it is possible in SQL. Maybe someone else can write SQL code to do this. But using the proper tool is also important; SQL seems inefficient here, a poor choice.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is STRING_AGG not available on your SQL Server? If so, then you should be able to passthru to your SQL server and then use STRING_AGG in your SQL.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2022 11:13:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looking-for-equivalent-function-is-SAS/m-p/825884#M326209</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-07-28T11:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for equivalent function is SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looking-for-equivalent-function-is-SAS/m-p/825888#M326213</link>
      <description>&lt;P&gt;This function is used with one of the variable/column and I am using multiple variable selection with case when statement, so to go for other sas option/tool looks more effort or may not convenient. So hardly looking to check it with same PROC SQL option. If not possible ultimately then I can go for other option. I don't have SQL Server to perform this checks. In-fact, the requirement is to convert the SQL Server queries to SAS code. The best and less effort option, I found is PROC SQL.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2022 11:26:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looking-for-equivalent-function-is-SAS/m-p/825888#M326213</guid>
      <dc:creator>dewanganrahul</dc:creator>
      <dc:date>2022-07-28T11:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for equivalent function is SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looking-for-equivalent-function-is-SAS/m-p/825890#M326214</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/56602"&gt;@dewanganrahul&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;In-fact, the requirement is to convert the SQL Server queries to SAS code. The best and less effort option, I found is PROC SQL.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I disagree. Using the full range of SAS tools and picking the appropriate tool is always going to be more efficient and less effort.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2022 11:40:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looking-for-equivalent-function-is-SAS/m-p/825890#M326214</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-07-28T11:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for equivalent function is SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looking-for-equivalent-function-is-SAS/m-p/825893#M326215</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/56602"&gt;@dewanganrahul&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;There is no equivalent function in SAS Proc SQL; If you want to implement this in SAS, then the post by&amp;nbsp; &amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;' is the right way for you. Or else you have to use SQL pass through (Execute by..).&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2022 11:33:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looking-for-equivalent-function-is-SAS/m-p/825893#M326215</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2022-07-28T11:33:50Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for equivalent function is SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looking-for-equivalent-function-is-SAS/m-p/825898#M326219</link>
      <description>&lt;P&gt;If you're using SAS, it's better to just stick with the built-in procedures that go row-by-row in the PDV. A single DATA step solution would be:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input col1 :$20.;
datalines;
if
you
want
a
happy
life
save
earth
;
run;

data want (keep = want_var);
	do until (lr);
		length want_var $100.;
		set have end = lr;
		temp = col1;
		want_var = catx('-', want_var, temp);
	end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Jul 2022 12:04:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looking-for-equivalent-function-is-SAS/m-p/825898#M326219</guid>
      <dc:creator>maguiremq</dc:creator>
      <dc:date>2022-07-28T12:04:37Z</dc:date>
    </item>
  </channel>
</rss>

