<?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 concatenating all observations in single in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/concatenating-all-observations-in-single/m-p/95792#M20144</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Following is my dataset&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input var1 $20;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;robert&lt;/P&gt;&lt;P&gt;is&lt;/P&gt;&lt;P&gt;my &lt;/P&gt;&lt;P&gt;boss&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now , i want to have one single macro variable which would resolve to &lt;STRONG&gt;robert is my boss&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In short, I want to concatenate all obseervations in one single macro. Catch is not to use Proc sql. I know below single statement would have solved my purpose, but I have to use datastep and not proc sql.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc sql; select var1 into :macvar1 separated by " " from have; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Any help would be highly appreciated&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 05 Jun 2013 08:45:20 GMT</pubDate>
    <dc:creator>forumsguy</dc:creator>
    <dc:date>2013-06-05T08:45:20Z</dc:date>
    <item>
      <title>concatenating all observations in single</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concatenating-all-observations-in-single/m-p/95792#M20144</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Following is my dataset&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input var1 $20;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;robert&lt;/P&gt;&lt;P&gt;is&lt;/P&gt;&lt;P&gt;my &lt;/P&gt;&lt;P&gt;boss&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now , i want to have one single macro variable which would resolve to &lt;STRONG&gt;robert is my boss&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In short, I want to concatenate all obseervations in one single macro. Catch is not to use Proc sql. I know below single statement would have solved my purpose, but I have to use datastep and not proc sql.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc sql; select var1 into :macvar1 separated by " " from have; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Any help would be highly appreciated&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jun 2013 08:45:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concatenating-all-observations-in-single/m-p/95792#M20144</guid>
      <dc:creator>forumsguy</dc:creator>
      <dc:date>2013-06-05T08:45:20Z</dc:date>
    </item>
    <item>
      <title>Re: concatenating all observations in single</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concatenating-all-observations-in-single/m-p/95793#M20145</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why not SQL?&lt;/P&gt;&lt;P&gt;One should chose whatever tool seems best/easiest for each task...&lt;/P&gt;&lt;P&gt;Anyway, concatenate your vaues into a retained value, and the call symput when the data step reaches the last record/EOF (I guess that your real life data is not provided in datalines)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jun 2013 09:12:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concatenating-all-observations-in-single/m-p/95793#M20145</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2013-06-05T09:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: concatenating all observations in single</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concatenating-all-observations-in-single/m-p/95794#M20146</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Agree Linus, but that's what my client's requirement is. They are insisting on data steps as they previously had experienced that having mixed macro variables (few from datastep and few from proc sql) tend to create problems in their environment. Anyways, can you please elaborate on your approach (EOF and retain). I tried using that as well , however it could not work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jun 2013 09:17:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concatenating-all-observations-in-single/m-p/95794#M20146</guid>
      <dc:creator>forumsguy</dc:creator>
      <dc:date>2013-06-05T09:17:10Z</dc:date>
    </item>
    <item>
      <title>Re: concatenating all observations in single</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concatenating-all-observations-in-single/m-p/95795#M20147</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I had the same idea as &lt;A __default_attr="119192" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;.&amp;nbsp; Here is the code I wrote&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;set have end=last;&lt;/P&gt;&lt;P&gt;length result $200;&lt;/P&gt;&lt;P&gt;retain result;&lt;/P&gt;&lt;P&gt;call catx(" ",result,var1);&lt;/P&gt;&lt;P&gt;if last then call symput('macvar1',result);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put &amp;amp;macvar1.;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jun 2013 09:20:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concatenating-all-observations-in-single/m-p/95795#M20147</guid>
      <dc:creator>Keith</dc:creator>
      <dc:date>2013-06-05T09:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: concatenating all observations in single</title>
      <link>https://communities.sas.com/t5/SAS-Programming/concatenating-all-observations-in-single/m-p/95796#M20148</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks keith... that worked .. I had used retain earlier in sum but never thought it could be applied to char variables as well &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jun 2013 09:35:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/concatenating-all-observations-in-single/m-p/95796#M20148</guid>
      <dc:creator>forumsguy</dc:creator>
      <dc:date>2013-06-05T09:35:17Z</dc:date>
    </item>
  </channel>
</rss>

