<?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: How to combine data from multiple cells into one cell in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729119#M226873</link>
    <description>I am trying to mix a code since there is no GUI to do what I need.</description>
    <pubDate>Thu, 25 Mar 2021 16:13:23 GMT</pubDate>
    <dc:creator>tazz_bh</dc:creator>
    <dc:date>2021-03-25T16:13:23Z</dc:date>
    <item>
      <title>How to combine data from multiple cells into one cell</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729034#M226844</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;would like to combine data from multiple cells into one cell using&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;SAS Data Integration Studio&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;My data is divided into three different tables, as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Table 1&lt;/STRONG&gt; (Number of columns is unknown)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="s-table-container"&gt;Col 1 Col 2 Col 3 &lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;City A&lt;/TD&gt;&lt;TD&gt;City B&lt;/TD&gt;&lt;TD&gt;City C&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&lt;STRONG&gt;Table 2&lt;/STRONG&gt; (Number of columns is unknown)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="s-table-container"&gt;Col 1 Col 2 Col 3 &lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;State A&lt;/TD&gt;&lt;TD&gt;State B&lt;/TD&gt;&lt;TD&gt;State C&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&lt;STRONG&gt;Table 3&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="s-table-container"&gt;Variable 1 Variable 2 &lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;x&lt;/TD&gt;&lt;TD&gt;y&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&lt;STRONG&gt;Desired final table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;That is, I want to create a final table in which I can join the data from table 1 (Number of columns is unknown) in just one field and the data from table 2 (Number of columns is also unknown) in another field, separating the respective values ​​with a comma.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="s-table-container"&gt;Variable 1 Variable 2 States Cities &lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;x&lt;/TD&gt;&lt;TD&gt;y&lt;/TD&gt;&lt;TD&gt;State A, State B, State C&lt;/TD&gt;&lt;TD&gt;City A, City B, City C&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone help me with the code so I can count columns and then CATX () without having to do mappings, since I don't know how many columns I will have? In addition, the next time I run the job, some city may have left the list, which reduces my number of columns.&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 12:50:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729034#M226844</guid>
      <dc:creator>tazz_bh</dc:creator>
      <dc:date>2021-03-25T12:50:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data from multiple cells into one cell</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729040#M226848</link>
      <description>&lt;P&gt;So all your tables will always have only one observation each?&lt;/P&gt;
&lt;P&gt;How were those tables created?&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 13:12:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729040#M226848</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-03-25T13:12:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data from multiple cells into one cell</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729042#M226850</link>
      <description>&lt;P&gt;We need more data,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For instance, in the data, table 1 &amp;amp; 2, when a column does not have a city or state, does it have a consistent value indicating that the data is missing.&amp;nbsp; Are empty strings used for that, or what?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 13:15:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729042#M226850</guid>
      <dc:creator>PhilC</dc:creator>
      <dc:date>2021-03-25T13:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data from multiple cells into one cell</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729060#M226858</link>
      <description>&lt;P&gt;The columns in Tables 1 and 2 are created automatically if there is data in my source table. That is, if there are 30 cities, col 1 to col 30 are created automatically. If there are only 3 cities, only col 1 to col 3 will be created.&amp;nbsp;And this same logic is used for the state table (table 2)&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 14:16:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729060#M226858</guid>
      <dc:creator>tazz_bh</dc:creator>
      <dc:date>2021-03-25T14:16:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data from multiple cells into one cell</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729062#M226859</link>
      <description>&lt;P&gt;&lt;SPAN&gt;The objective is to join all the observations in Table 1 in a single column and all the observations in Table 2 in a single column, so that each of these two tables has only one column.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The columns in Tables 1 and 2 are created automatically if there is data in my source table. That is, if there are 30 cities, col 1 to col 30 are created automatically. If there are only 3 cities, only col 1 to col 3 will be created.&amp;nbsp;And this same logic is used for the state table (table 2).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The point is that the number of columns that tables 1 and 2 have can be different each time I run my job. Since cities and states can be inserted or excluded from my source table.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 14:24:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729062#M226859</guid>
      <dc:creator>tazz_bh</dc:creator>
      <dc:date>2021-03-25T14:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data from multiple cells into one cell</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729064#M226861</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/375466"&gt;@tazz_bh&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;The columns in Tables 1 and 2 are created automatically if there is data in my source table. That is, if there are 30 cities, col 1 to col 30 are created automatically. If there are only 3 cities, only col 1 to col 3 will be created.&amp;nbsp;And this same logic is used for the state table (table 2)&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;And do your source tables already have that unfavorable wide layout?&lt;/P&gt;
&lt;P&gt;Note that data is much easier to handle with a fixed number of columns and a variable number of observations.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 14:33:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729064#M226861</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-03-25T14:33:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data from multiple cells into one cell</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729068#M226862</link>
      <description>&lt;P&gt;I transposed rows to columns. I can also do catx () for all rows, but it follows the same logic: The column number (cities) will be fixed at 1, but the number of rows will be unknown, so CATX would have to be made for an unknown number of rows. Do you think it's easier that way?&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 14:51:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729068#M226862</guid>
      <dc:creator>tazz_bh</dc:creator>
      <dc:date>2021-03-25T14:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data from multiple cells into one cell</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729070#M226863</link>
      <description>&lt;P&gt;Assuming this is also you?&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/66766062/combine-data-from-two-or-more-field-into-one-field-in-sas-data-integration-studi?noredirect=1#comment118080525_66766062" target="_blank" rel="noopener"&gt;https://stackoverflow.com/questions/66766062/combine-data-from-two-or-more-field-into-one-field-in-sas-data-integration-studi?noredirect=1#comment118080525_66766062&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have a naming convention for your City/State table? If so this is trivial, if not, then you need some extra steps.&lt;/P&gt;
&lt;P&gt;You should show what you've tried, rather than say you've tried something. This assumes your city variables are named city1-cityn and your state variables are named state1-stateN.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming you have a naming convention on your city and state table this should work. If you don't you'll have to query the names of the columns from dictionary.table or dictionary.column and save those to a macro variable to use the CATX() function.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
merge table1 table2 table3 table4;
state = catx(of state:);
city = catx(of city:);
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 14:59:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729070#M226863</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-03-25T14:59:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data from multiple cells into one cell</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729092#M226867</link>
      <description>&lt;P&gt;Concatenating is easy across rows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have end=done;
length cities $1000;
cities = catx(",",cities,city);
if done;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you have a grouping variable, use a BY statement and FIRST./LAST. syntax. In which case, you also create the final table by merging with that same BY variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 15:26:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729092#M226867</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-03-25T15:26:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data from multiple cells into one cell</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729100#M226868</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/375466"&gt;@tazz_bh&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;would like to combine data from multiple cells into one cell using&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;SAS Data Integration Studio&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;My data is divided into three different tables, as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Table 1&lt;/STRONG&gt; (Number of columns is unknown)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="s-table-container"&gt;Col 1 Col 2 Col 3
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;City A&lt;/TD&gt;
&lt;TD&gt;City B&lt;/TD&gt;
&lt;TD&gt;City C&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;P&gt;&lt;STRONG&gt;Table 2&lt;/STRONG&gt; (Number of columns is unknown)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="s-table-container"&gt;Col 1 Col 2 Col 3
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;State A&lt;/TD&gt;
&lt;TD&gt;State B&lt;/TD&gt;
&lt;TD&gt;State C&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;P&gt;&lt;STRONG&gt;Table 3&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="s-table-container"&gt;Variable 1 Variable 2
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;x&lt;/TD&gt;
&lt;TD&gt;y&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;P&gt;&lt;STRONG&gt;Desired final table:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;That is, I want to create a final table in which I can join the data from table 1 (Number of columns is unknown) in just one field and the data from table 2 (Number of columns is also unknown) in another field, separating the respective values ​​with a comma.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="s-table-container"&gt;Variable 1 Variable 2 States Cities
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;x&lt;/TD&gt;
&lt;TD&gt;y&lt;/TD&gt;
&lt;TD&gt;State A, State B, State C&lt;/TD&gt;
&lt;TD&gt;City A, City B, City C&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can someone help me with the code so I can count columns and then CATX () without having to do mappings, since I don't know how many columns I will have? In addition, the next time I run the job, some city may have left the list, which reduces my number of columns.&lt;/P&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please describe just what you intend to do with the resulting data. This kind of data structure is obnoxious for any form of modeling, analysis, summary or even legible reporting.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 15:37:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729100#M226868</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-03-25T15:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data from multiple cells into one cell</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729110#M226870</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this&amp;nbsp; diagram:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tazz_bh_1-1616687372160.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56494iD3EDFC20ED77999F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tazz_bh_1-1616687372160.png" alt="tazz_bh_1-1616687372160.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;With this data:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tazz_bh_2-1616687427427.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56495i69ED5AD30FF2F5C8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tazz_bh_2-1616687427427.png" alt="tazz_bh_2-1616687427427.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I wall I want is to put NYC and LAX in a single field. In this example I have only two cities, but at any given moment I can have several other cities, so I need a code that is malleable enough to concatenate all cities rows, regardless of the number of cities I have in this column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Should I use a User Written code to do so?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tazz_bh_3-1616687697515.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56497i0FEEB20E9B64DE75/image-size/medium?v=v2&amp;amp;px=400" role="button" title="tazz_bh_3-1616687697515.png" alt="tazz_bh_3-1616687697515.png" /&gt;&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, 25 Mar 2021 15:55:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729110#M226870</guid>
      <dc:creator>tazz_bh</dc:creator>
      <dc:date>2021-03-25T15:55:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data from multiple cells into one cell</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729116#M226872</link>
      <description>Your reply on SO said you were using code.</description>
      <pubDate>Thu, 25 Mar 2021 16:01:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729116#M226872</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-03-25T16:01:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data from multiple cells into one cell</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729119#M226873</link>
      <description>I am trying to mix a code since there is no GUI to do what I need.</description>
      <pubDate>Thu, 25 Mar 2021 16:13:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729119#M226873</guid>
      <dc:creator>tazz_bh</dc:creator>
      <dc:date>2021-03-25T16:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data from multiple cells into one cell</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729140#M226876</link>
      <description>&lt;P&gt;Full solution to your original problem.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data t1;
informat city1-city3 $8.;
input city1-city3;
cards;
CityA CityB CityC
;;;;;
run;

data t2;
informat state1-state4 $8.;
input state1-state4 ;
cards;
State1 State2 State3 State4
;;;;
run;

data t3;
input v1 $ v2 $;
cards;
x y
;
run;

data want;
merge t3 t1 t2;
list_state = catx(", ", of city:);
list_city = catx(", ", of state:);

drop state: city:;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
Obs	v1	v2	list_state	list_city
1	x	y	CityA, CityB, CityC	State1, State2, State3, State4&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Mar 2021 17:04:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729140#M226876</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-03-25T17:04:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data from multiple cells into one cell</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729146#M226877</link>
      <description>&lt;P&gt;Building on this.&amp;nbsp; The city dataset is a "tall data set" that requires a transpose to get it to be in the form of the original post.&amp;nbsp; - But - if each account ( ID, etc) has variable number of cities we will need to handle that too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
   CREATE TABLE WORK.QUERY_FOR_SHOES AS 
   SELECT DISTINCT t1.Region, 
          /* Subsidiary, ** First three characters** */
            (UPCASE(substr(t1.Subsidiary,1,3))) AS Subsidiary
      FROM SASHELP.SHOES t1;
QUIT;

PROC TRANSPOSE DATA=WORK.QUERY_FOR_SHOES
	OUT=WORK.Transposed(DROP=_:)
	PREFIX=City_
;
	BY Region;
	VAR Subsidiary;
RUN; QUIT;

data want;
  set Transposed;
    drop city_: ;
  array city $ city_:;
  length list_city $200;
    list_city=" ";
  do over city;
    if not missing(city)
      then list_city=catx(', ',list_city,city);
  end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since we dont "have" example data to work with, I made some data from SASHELP.SHOES.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 17:36:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729146#M226877</guid>
      <dc:creator>PhilC</dc:creator>
      <dc:date>2021-03-25T17:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine data from multiple cells into one cell</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729151#M226880</link>
      <description>&lt;P&gt;I'll just say too, that its odd to me that you are taking one set of city and states per one record at a time.&amp;nbsp; I think I need to learn more about SAS&amp;nbsp;Data Integration Studio, but if multiple sets of cities and states are being handled, then this is how I would handle it in SAS foundation.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Mar 2021 17:50:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-combine-data-from-multiple-cells-into-one-cell/m-p/729151#M226880</guid>
      <dc:creator>PhilC</dc:creator>
      <dc:date>2021-03-25T17:50:53Z</dc:date>
    </item>
  </channel>
</rss>

