<?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: Can a SAS Dataset be updated in a DATA STEP?   Not copied in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Can-a-SAS-Dataset-be-updated-in-a-DATA-STEP-Not-copied/m-p/29031#M5447</link>
    <description>Thanks.   The modify did not show up easily while searching the online documentation.    &lt;BR /&gt;
&lt;BR /&gt;
The following worked.   &lt;BR /&gt;
&lt;BR /&gt;
data work.master;&lt;BR /&gt;
        ARRAY id(&amp;amp;max);&lt;BR /&gt;
    %do x=1 %to &amp;amp;max %by 1;&lt;BR /&gt;
        id(&amp;amp;x)=&amp;amp;&amp;amp;id&amp;amp;x;&lt;BR /&gt;
        putlog 'id = ' id(&amp;amp;x);&lt;BR /&gt;
    %end;&lt;BR /&gt;
  loop: &lt;BR /&gt;
    modify work.master end=eoj;  &lt;BR /&gt;
        id=newid(id);&lt;BR /&gt;
        replace;&lt;BR /&gt;
        if eoj then stop;&lt;BR /&gt;
        goto loop;&lt;BR /&gt;
run;</description>
    <pubDate>Thu, 07 May 2009 16:02:11 GMT</pubDate>
    <dc:creator>JMarkW</dc:creator>
    <dc:date>2009-05-07T16:02:11Z</dc:date>
    <item>
      <title>Can a SAS Dataset be updated in a DATA STEP?   Not copied</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-a-SAS-Dataset-be-updated-in-a-DATA-STEP-Not-copied/m-p/29029#M5445</link>
      <description>I need to change a value of a field on a giant SAS dataset based on an array match.   Normally this would just be making a copy of the file.   Unfortunately this file will have millions of records with a record length of 5000 bytes.   It would be much more efficient to NOT copy the data but update the column in place.   Note that no columns are indexed on this dataset so there are no problems in changing column values.&lt;BR /&gt;
&lt;BR /&gt;
I could do this in PROC SQL but it would slower that just using a DATA step with an array lookup.  That is, if a datastep can update a dataset in place without copying it.&lt;BR /&gt;
&lt;BR /&gt;
Does anybody know how to do this in a DATA step?</description>
      <pubDate>Thu, 07 May 2009 14:33:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-a-SAS-Dataset-be-updated-in-a-DATA-STEP-Not-copied/m-p/29029#M5445</guid>
      <dc:creator>JMarkW</dc:creator>
      <dc:date>2009-05-07T14:33:05Z</dc:date>
    </item>
    <item>
      <title>Re: Can a SAS Dataset be updated in a DATA STEP?   Not copied</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-a-SAS-Dataset-be-updated-in-a-DATA-STEP-Not-copied/m-p/29030#M5446</link>
      <description>I think the data step MODIFY statement is what you are looking.</description>
      <pubDate>Thu, 07 May 2009 14:36:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-a-SAS-Dataset-be-updated-in-a-DATA-STEP-Not-copied/m-p/29030#M5446</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2009-05-07T14:36:44Z</dc:date>
    </item>
    <item>
      <title>Re: Can a SAS Dataset be updated in a DATA STEP?   Not copied</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-a-SAS-Dataset-be-updated-in-a-DATA-STEP-Not-copied/m-p/29031#M5447</link>
      <description>Thanks.   The modify did not show up easily while searching the online documentation.    &lt;BR /&gt;
&lt;BR /&gt;
The following worked.   &lt;BR /&gt;
&lt;BR /&gt;
data work.master;&lt;BR /&gt;
        ARRAY id(&amp;amp;max);&lt;BR /&gt;
    %do x=1 %to &amp;amp;max %by 1;&lt;BR /&gt;
        id(&amp;amp;x)=&amp;amp;&amp;amp;id&amp;amp;x;&lt;BR /&gt;
        putlog 'id = ' id(&amp;amp;x);&lt;BR /&gt;
    %end;&lt;BR /&gt;
  loop: &lt;BR /&gt;
    modify work.master end=eoj;  &lt;BR /&gt;
        id=newid(id);&lt;BR /&gt;
        replace;&lt;BR /&gt;
        if eoj then stop;&lt;BR /&gt;
        goto loop;&lt;BR /&gt;
run;</description>
      <pubDate>Thu, 07 May 2009 16:02:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-a-SAS-Dataset-be-updated-in-a-DATA-STEP-Not-copied/m-p/29031#M5447</guid>
      <dc:creator>JMarkW</dc:creator>
      <dc:date>2009-05-07T16:02:11Z</dc:date>
    </item>
  </channel>
</rss>

