<?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: code for creating file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/code-for-creating-file/m-p/240733#M44460</link>
    <description>&lt;P&gt;awesome...thanks a lot for the code...&lt;/P&gt;</description>
    <pubDate>Wed, 23 Dec 2015 22:19:14 GMT</pubDate>
    <dc:creator>mahfuz_pops</dc:creator>
    <dc:date>2015-12-23T22:19:14Z</dc:date>
    <item>
      <title>code for creating file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/code-for-creating-file/m-p/240192#M44285</link>
      <description>&lt;P&gt;hi, actually it would be great if I can have code for the following probem&lt;/P&gt;&lt;P&gt;I have a large no. of variable but I'm just presenting for few. suppose I have a file named A of the following form&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; s &amp;nbsp; &amp;nbsp;e &amp;nbsp; &amp;nbsp; d &amp;nbsp; v1 &amp;nbsp; &amp;nbsp;v2 &amp;nbsp; &amp;nbsp;v3 &amp;nbsp; &amp;nbsp;v4 &amp;nbsp; v5 &amp;nbsp; &amp;nbsp;v6&lt;/P&gt;&lt;P&gt;&lt;FONT color="#339966"&gt;1&lt;/FONT&gt; &amp;nbsp; &amp;nbsp;2 &amp;nbsp; &amp;nbsp;6 &amp;nbsp; &amp;nbsp; 2 &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;&lt;FONT color="#339966"&gt;2 &lt;/FONT&gt;&amp;nbsp; &amp;nbsp;3 &amp;nbsp; &amp;nbsp;5 &amp;nbsp; &amp;nbsp; 4 &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#339966"&gt;3&lt;/FONT&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT color="#000000"&gt;1 &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#339966"&gt;4 &lt;/FONT&gt;&amp;nbsp; &amp;nbsp;2 &amp;nbsp; &amp;nbsp;3 &amp;nbsp; &amp;nbsp; 5 &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the above data file, red colored numbers are just the serial number, and blank spaces means missing variables&lt;/P&gt;&lt;P&gt;Now I want to put &lt;FONT color="#FF0000"&gt;5&lt;FONT color="#000000"&gt;&amp;nbsp;in the variables starting from s=2 and ending at e=6, e.i. starting from v2 to v6, if the variable d is greater than 1. But I want the columns s &amp;amp; e as the index of starting and ending of entry, I don't want the incorporation of variables directly, so that I can use this programme for a very large number of variables and cases, and for that the entry of &lt;FONT color="#FF0000"&gt;&lt;SPAN&gt;5&amp;nbsp;&lt;FONT color="#000000"&gt;in the data file depends on the s and e variables. e.g. If s is 2 then the recoding should start from v2 and if e is 6 the recoding should end at v6. Now I want my new table looks like as follows:&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; s &amp;nbsp; &amp;nbsp;e &amp;nbsp; &amp;nbsp; d &amp;nbsp; v1 &amp;nbsp; &amp;nbsp;v2 &amp;nbsp; &amp;nbsp;v3 &amp;nbsp; &amp;nbsp;v4 &amp;nbsp; v5 &amp;nbsp; &amp;nbsp;v6&lt;/P&gt;&lt;P&gt;&lt;FONT color="#339966"&gt;1&lt;/FONT&gt; &amp;nbsp; &amp;nbsp;2 &amp;nbsp; &amp;nbsp;6 &amp;nbsp; &amp;nbsp; 2 &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &lt;FONT color="#FF0000"&gt;5 &amp;nbsp; &amp;nbsp; &lt;SPAN&gt;5 &amp;nbsp; &amp;nbsp; &amp;nbsp;5 &amp;nbsp; &amp;nbsp;&amp;nbsp;5 &amp;nbsp; &amp;nbsp; &amp;nbsp;5&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#339966"&gt;2 &lt;/FONT&gt;&amp;nbsp; &amp;nbsp;3 &amp;nbsp; &amp;nbsp;5 &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;FONT color="#FF0000"&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#339966"&gt;3&lt;/FONT&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT color="#000000"&gt;1 &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#339966"&gt;4 &lt;/FONT&gt;&amp;nbsp; &amp;nbsp;2 &amp;nbsp; &amp;nbsp;3 &amp;nbsp; &amp;nbsp; 5 &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &lt;SPAN&gt;&lt;FONT color="#FF0000"&gt;5&lt;/FONT&gt; &lt;/SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;FONT color="#FF0000"&gt;&lt;SPAN&gt;5 &lt;/SPAN&gt;&amp;nbsp; &amp;nbsp;&lt;/FONT&gt;&amp;nbsp; 1 &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This means that, the previous entries in the table remains as before and just put &lt;FONT color="#FF0000"&gt;5&amp;nbsp;&lt;FONT color="#000000"&gt;in the required fields.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;FONT color="#000000"&gt;It would be of great healp if you send me the code for doing this.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2015 01:53:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/code-for-creating-file/m-p/240192#M44285</guid>
      <dc:creator>mahfuz_pops</dc:creator>
      <dc:date>2015-12-21T01:53:19Z</dc:date>
    </item>
    <item>
      <title>Re: code for creating file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/code-for-creating-file/m-p/240201#M44287</link>
      <description>&lt;P&gt;Use an array :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input       
s    e     d   v1    v2    v3    v4   v5    v6;
datalines;
2    6     2    1     .     .     .    .     .
3    5     0    1     1     .     .    .     1
.    .     .    1     1     1     1    .     1
2    3     5    1     .     .     1    1     1
;

data want;
set have;
array _v{*} v:;
if d &amp;gt; 1 then
    do i = max(1,s) to min(dim(_v),e);
        _v{i} = 5;
        end;
drop i;
run;

proc print data=want noobs; run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Dec 2015 02:39:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/code-for-creating-file/m-p/240201#M44287</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-12-21T02:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: code for creating file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/code-for-creating-file/m-p/240733#M44460</link>
      <description>&lt;P&gt;awesome...thanks a lot for the code...&lt;/P&gt;</description>
      <pubDate>Wed, 23 Dec 2015 22:19:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/code-for-creating-file/m-p/240733#M44460</guid>
      <dc:creator>mahfuz_pops</dc:creator>
      <dc:date>2015-12-23T22:19:14Z</dc:date>
    </item>
  </channel>
</rss>

