<?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 use value to populate new variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/use-value-to-populate-new-variable/m-p/426180#M104993</link>
    <description>&lt;P&gt;I think an array will solve this problem but I'm not very experienced using them.&amp;nbsp; I have one field delinquent count, I would like to use that field to assign a value to another field.&amp;nbsp; If delinquent count is 3, then the value of delinquent amount should go into d_cycle3.&amp;nbsp; Below is some code that will show what I am trying to do.&amp;nbsp; I've been playing around with arrays trying to get it done with no success. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there's a better way than an array I'm open to that too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data have;&lt;BR /&gt;infile cards;&lt;BR /&gt;input id$ cycle_delq$ CURRENT_DLQ_AMT;&lt;BR /&gt;cards;&lt;BR /&gt;001 0 0&lt;BR /&gt;001 0 0&lt;BR /&gt;001 1 5&lt;BR /&gt;001 1 5&lt;BR /&gt;001 2 10&lt;BR /&gt;001 3 10&lt;BR /&gt;001 4 15&lt;BR /&gt;001 4 15&lt;BR /&gt;001 5 20&lt;BR /&gt;001 C 0&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;array flow{6} d_cycle0-d_cycle5;&lt;BR /&gt;if input(cycle_delq,1.) = 0 then d_cycle0 = CURRENT_DLQ_AMT;&lt;BR /&gt;if input(cycle_delq,1.) = 1 then d_cycle1 = CURRENT_DLQ_AMT;&lt;BR /&gt;if input(cycle_delq,1.) = 2 then d_cycle2 = CURRENT_DLQ_AMT;&lt;BR /&gt;if input(cycle_delq,1.) = 3 then d_cycle3 = CURRENT_DLQ_AMT;&lt;BR /&gt;if input(cycle_delq,1.) = 4 then d_cycle4 = CURRENT_DLQ_AMT;&lt;BR /&gt;if input(cycle_delq,1.) = 5 then d_cycle5 = CURRENT_DLQ_AMT;&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Jan 2018 17:50:38 GMT</pubDate>
    <dc:creator>Steelers_In_DC</dc:creator>
    <dc:date>2018-01-09T17:50:38Z</dc:date>
    <item>
      <title>use value to populate new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/use-value-to-populate-new-variable/m-p/426180#M104993</link>
      <description>&lt;P&gt;I think an array will solve this problem but I'm not very experienced using them.&amp;nbsp; I have one field delinquent count, I would like to use that field to assign a value to another field.&amp;nbsp; If delinquent count is 3, then the value of delinquent amount should go into d_cycle3.&amp;nbsp; Below is some code that will show what I am trying to do.&amp;nbsp; I've been playing around with arrays trying to get it done with no success. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there's a better way than an array I'm open to that too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data have;&lt;BR /&gt;infile cards;&lt;BR /&gt;input id$ cycle_delq$ CURRENT_DLQ_AMT;&lt;BR /&gt;cards;&lt;BR /&gt;001 0 0&lt;BR /&gt;001 0 0&lt;BR /&gt;001 1 5&lt;BR /&gt;001 1 5&lt;BR /&gt;001 2 10&lt;BR /&gt;001 3 10&lt;BR /&gt;001 4 15&lt;BR /&gt;001 4 15&lt;BR /&gt;001 5 20&lt;BR /&gt;001 C 0&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;array flow{6} d_cycle0-d_cycle5;&lt;BR /&gt;if input(cycle_delq,1.) = 0 then d_cycle0 = CURRENT_DLQ_AMT;&lt;BR /&gt;if input(cycle_delq,1.) = 1 then d_cycle1 = CURRENT_DLQ_AMT;&lt;BR /&gt;if input(cycle_delq,1.) = 2 then d_cycle2 = CURRENT_DLQ_AMT;&lt;BR /&gt;if input(cycle_delq,1.) = 3 then d_cycle3 = CURRENT_DLQ_AMT;&lt;BR /&gt;if input(cycle_delq,1.) = 4 then d_cycle4 = CURRENT_DLQ_AMT;&lt;BR /&gt;if input(cycle_delq,1.) = 5 then d_cycle5 = CURRENT_DLQ_AMT;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 17:50:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/use-value-to-populate-new-variable/m-p/426180#M104993</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2018-01-09T17:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: use value to populate new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/use-value-to-populate-new-variable/m-p/426182#M104994</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; flow{input(cycle_delq,1.) - 1} = CURRENT_DLQ_AMT;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Jan 2018 17:59:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/use-value-to-populate-new-variable/m-p/426182#M104994</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-01-09T17:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: use value to populate new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/use-value-to-populate-new-variable/m-p/426184#M104995</link>
      <description>&lt;P&gt;data wantt;&lt;BR /&gt;set have1;&lt;BR /&gt;array flow{0:5} d_cycle0-d_cycle5;&lt;BR /&gt;temp=input(cycle_delq,1.);&lt;BR /&gt;flow(temp)=CURRENT_DLQ_AMT;&lt;/P&gt;&lt;P&gt;drop temp;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDITED: To add &lt;STRONG&gt;drop temp&lt;/STRONG&gt; statement&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 18:03:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/use-value-to-populate-new-variable/m-p/426184#M104995</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-01-09T18:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: use value to populate new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/use-value-to-populate-new-variable/m-p/426187#M104996</link>
      <description>&lt;P&gt;That was close, thanks so much.&amp;nbsp; Because of the potential for Character values there is one more step needed:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;array flow{0:5} d_cycle0-d_cycle5;&lt;BR /&gt;&lt;STRONG&gt;if not missing(input(cycle_delq,1.)) then do;&lt;/STRONG&gt;&lt;BR /&gt;temp=input(cycle_delq,1.);&lt;BR /&gt;flow(temp)=CURRENT_DLQ_AMT;&lt;BR /&gt;&lt;STRONG&gt;end;&lt;/STRONG&gt;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 18:05:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/use-value-to-populate-new-variable/m-p/426187#M104996</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2018-01-09T18:05:53Z</dc:date>
    </item>
  </channel>
</rss>

