<?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 SAS macro Call Symputx _N_ initiation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro-Call-Symputx-N-initiation/m-p/201180#M37591</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;anybody can help me how can i initiate my _n_ from 1 when my condition is met.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using following code to do that. It is working but it has problem where _n_ is linked to 'IF' condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i.e. if _Type_ = 2 is appearing in row number 5 in my table "AirCont" then my call symputx outcome gives me the outome to 'Y5' , whereas I want that _N_ initiate/incriment only when condition is met.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;set AirCont;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if _Type_ = 2 then call symputx(compress('Y' || _n_),year);&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;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;KP&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 Mar 2015 16:53:07 GMT</pubDate>
    <dc:creator>KrunalPatel</dc:creator>
    <dc:date>2015-03-13T16:53:07Z</dc:date>
    <item>
      <title>SAS macro Call Symputx _N_ initiation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro-Call-Symputx-N-initiation/m-p/201180#M37591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;anybody can help me how can i initiate my _n_ from 1 when my condition is met.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using following code to do that. It is working but it has problem where _n_ is linked to 'IF' condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i.e. if _Type_ = 2 is appearing in row number 5 in my table "AirCont" then my call symputx outcome gives me the outome to 'Y5' , whereas I want that _N_ initiate/incriment only when condition is met.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;set AirCont;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if _Type_ = 2 then call symputx(compress('Y' || _n_),year);&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;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;KP&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Mar 2015 16:53:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macro-Call-Symputx-N-initiation/m-p/201180#M37591</guid>
      <dc:creator>KrunalPatel</dc:creator>
      <dc:date>2015-03-13T16:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: SAS macro Call Symputx _N_ initiation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro-Call-Symputx-N-initiation/m-p/201181#M37592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't use the automatic variable _n_&amp;nbsp; . Create your own counter and use that instead. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Mar 2015 17:02:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macro-Call-Symputx-N-initiation/m-p/201181#M37592</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-03-13T17:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: SAS macro Call Symputx _N_ initiation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro-Call-Symputx-N-initiation/m-p/201182#M37593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Perhaps I don't understand the question?&lt;/P&gt;&lt;P&gt;If you want your own counter just make your own counter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13.333333969116211px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.333333969116211px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; set AirCont;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.333333969116211px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; if _type_=2 then do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.333333969116211px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; n+1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.333333969116211px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="line-height: 1.5em; font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call symputx(compress('Y' || n),year);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.333333969116211px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="line-height: 1.5em; font-family: 'courier new', courier;"&gt;&amp;nbsp; end;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.333333969116211px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.333333969116211px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;If you want to use the _N_ as the count of how many times the data step as iterated then change your IF to a WHERE.&lt;/P&gt;&lt;P style="font-size: 13.333333969116211px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; set AirCont;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; where _type_=2 ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em; font-family: 'courier new', courier;"&gt;&amp;nbsp; call symputx(compress('Y' ||_n_),year);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Mar 2015 17:05:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macro-Call-Symputx-N-initiation/m-p/201182#M37593</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-03-13T17:05:20Z</dc:date>
    </item>
    <item>
      <title>Re: SAS macro Call Symputx _N_ initiation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro-Call-Symputx-N-initiation/m-p/201183#M37594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Reeza - sorry I was not clear enough.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom - Thanks i havent tried yet but your reply will work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks All&lt;/P&gt;&lt;P&gt;KP&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Mar 2015 16:08:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macro-Call-Symputx-N-initiation/m-p/201183#M37594</guid>
      <dc:creator>KrunalPatel</dc:creator>
      <dc:date>2015-03-18T16:08:07Z</dc:date>
    </item>
  </channel>
</rss>

