<?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 create groupid with muti cols in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-groupid-with-muti-cols/m-p/913424#M360041</link>
    <description>&lt;P&gt;This is why Fred Flintstone invented the &lt;FONT face="courier new,courier"&gt;FIRST.&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;LAST.&lt;/FONT&gt; structures for SAS data steps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    by var1 var2;
    if first.var1 then id=0;
    if first.var2 then id+1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 29 Jan 2024 16:10:22 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2024-01-29T16:10:22Z</dc:date>
    <item>
      <title>How to create groupid with muti cols</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-groupid-with-muti-cols/m-p/913419#M360037</link>
      <description>&lt;P&gt;Hello All,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to assign unique id based on the info from var1 and var2. Not sure how to do it.&amp;nbsp; New variable 'id' will restart from 1 when var1 changed.&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="stataq_0-1706543894087.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/93054i7EC69986D242C4EA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="stataq_0-1706543894087.png" alt="stataq_0-1706543894087.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;sample data:&lt;/P&gt;
&lt;P&gt;data have;&lt;BR /&gt;input var1 var2;&lt;BR /&gt;datalines;&lt;BR /&gt;1 1 &lt;BR /&gt;1 1 &lt;BR /&gt;1 3 &lt;BR /&gt;2 1 &lt;BR /&gt;2 2 &lt;BR /&gt;2 2 &lt;BR /&gt;2 5&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2024 16:01:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-groupid-with-muti-cols/m-p/913419#M360037</guid>
      <dc:creator>stataq</dc:creator>
      <dc:date>2024-01-29T16:01:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to create groupid with muti cols</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-groupid-with-muti-cols/m-p/913424#M360041</link>
      <description>&lt;P&gt;This is why Fred Flintstone invented the &lt;FONT face="courier new,courier"&gt;FIRST.&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;LAST.&lt;/FONT&gt; structures for SAS data steps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    by var1 var2;
    if first.var1 then id=0;
    if first.var2 then id+1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jan 2024 16:10:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-groupid-with-muti-cols/m-p/913424#M360041</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-01-29T16:10:22Z</dc:date>
    </item>
  </channel>
</rss>

