<?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: Copying the last group variable name to all other observations in the same group in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Copying-the-last-group-variable-name-to-all-other-observations/m-p/699275#M213916</link>
    <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;:&lt;BR /&gt;&lt;BR /&gt;Thanks. It worked.&lt;BR /&gt;&lt;BR /&gt;Sandyzman1</description>
    <pubDate>Mon, 16 Nov 2020 19:06:01 GMT</pubDate>
    <dc:creator>sandyzman1</dc:creator>
    <dc:date>2020-11-16T19:06:01Z</dc:date>
    <item>
      <title>Copying the last group variable name to all other observations in the same group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copying-the-last-group-variable-name-to-all-other-observations/m-p/699260#M213909</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I want to copy the variable name from the last group to all the other observations in the same group. For example, copying the last variable name (Country) in Category to all the blank space in the category.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Category&lt;/TD&gt;&lt;TD&gt;Country&lt;/TD&gt;&lt;TD&gt;Group&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;US&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Israel&lt;/TD&gt;&lt;TD&gt;1&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;&lt;TD&gt;Country&lt;/TD&gt;&lt;TD&gt;Canada&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Country&lt;/TD&gt;&lt;TD&gt;Australia&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Country&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;US&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Country&lt;/TD&gt;&lt;TD&gt;Israel&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Country&lt;/TD&gt;&lt;TD&gt;Canada&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Country&lt;/TD&gt;&lt;TD&gt;Australia&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code for the dataset I have:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data have;&lt;BR /&gt;infile datalines delimiter=',';&lt;BR /&gt;input Category $ Country $ group$;&lt;BR /&gt;datalines;&lt;BR /&gt;&amp;nbsp; ,USA , 1&lt;BR /&gt;,ISRAEL ,1&lt;BR /&gt;,CANADA, 1&lt;BR /&gt;Country, AUSTRALIA ,1&lt;BR /&gt;&amp;nbsp;,USA, 2&lt;BR /&gt;,ISRAEL ,2&lt;BR /&gt;,CANADA, 2&lt;BR /&gt;Country, AUSTRALIA ,2&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Best,&lt;/P&gt;&lt;P&gt;Sandyzman1&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 18:35:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copying-the-last-group-variable-name-to-all-other-observations/m-p/699260#M213909</guid>
      <dc:creator>sandyzman1</dc:creator>
      <dc:date>2020-11-16T18:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: Copying the last group variable name to all other observations in the same group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copying-the-last-group-variable-name-to-all-other-observations/m-p/699262#M213910</link>
      <description>&lt;P&gt;In this trivial example, you just need to put the text "Country" in the Category column, there's no copying needed. Is it really a more complicated problem? If so, can you give us a more realistic example?&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 18:46:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copying-the-last-group-variable-name-to-all-other-observations/m-p/699262#M213910</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-11-16T18:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: Copying the last group variable name to all other observations in the same group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copying-the-last-group-variable-name-to-all-other-observations/m-p/699268#M213913</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
if 0 then set have; /* sets length for all variables */
do until (category &amp;gt; "");
  set have;
end;
do until (c &amp;gt; "");
  set have (rename=(category=c));
  output;
end;
drop c;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I seem to be doing a lot of double DO loops lately ...&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 19:11:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copying-the-last-group-variable-name-to-all-other-observations/m-p/699268#M213913</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-16T19:11:05Z</dc:date>
    </item>
    <item>
      <title>Re: Copying the last group variable name to all other observations in the same group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copying-the-last-group-variable-name-to-all-other-observations/m-p/699274#M213915</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;&lt;/P&gt;&lt;P&gt;I am writing a macro to create a table for the univariable logistic regression. I was able to output the class variable which has only the last category. However, to merge the class table into the OR table using BY statement, I need to copy the last variable name to the rest of the empty cell by the group.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I just wanted to simplify the issue, so I created the table such that there is an empty space.&amp;nbsp; Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sandyzman1&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 19:05:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copying-the-last-group-variable-name-to-all-other-observations/m-p/699274#M213915</guid>
      <dc:creator>sandyzman1</dc:creator>
      <dc:date>2020-11-16T19:05:15Z</dc:date>
    </item>
    <item>
      <title>Re: Copying the last group variable name to all other observations in the same group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Copying-the-last-group-variable-name-to-all-other-observations/m-p/699275#M213916</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;:&lt;BR /&gt;&lt;BR /&gt;Thanks. It worked.&lt;BR /&gt;&lt;BR /&gt;Sandyzman1</description>
      <pubDate>Mon, 16 Nov 2020 19:06:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Copying-the-last-group-variable-name-to-all-other-observations/m-p/699275#M213916</guid>
      <dc:creator>sandyzman1</dc:creator>
      <dc:date>2020-11-16T19:06:01Z</dc:date>
    </item>
  </channel>
</rss>

