<?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: making same changes to 900 variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/making-same-changes-to-900-variables/m-p/180057#M265031</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;do u mind explainng a little more detail on how to write the code? im a sas novice.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Feb 2015 15:32:04 GMT</pubDate>
    <dc:creator>aarony</dc:creator>
    <dc:date>2015-02-24T15:32:04Z</dc:date>
    <item>
      <title>making same changes to 900 variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/making-same-changes-to-900-variables/m-p/180055#M265029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi have 900 variables in a dataset.&lt;/P&gt;&lt;P&gt;for each of them i want to do&lt;/P&gt;&lt;P&gt;data j2; set j1; If missing(var1)&amp;gt; 0 or var1 in ('NO', 'N', 'NA', ' ', '$$"ER", 9903') then newvar1= 0; Else newvar1= 1; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what is the b est way to do this in 900 variables?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 15:04:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/making-same-changes-to-900-variables/m-p/180055#M265029</guid>
      <dc:creator>aarony</dc:creator>
      <dc:date>2015-02-24T15:04:26Z</dc:date>
    </item>
    <item>
      <title>Re: making same changes to 900 variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/making-same-changes-to-900-variables/m-p/180056#M265030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ARRAY&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 15:28:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/making-same-changes-to-900-variables/m-p/180056#M265030</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2015-02-24T15:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: making same changes to 900 variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/making-same-changes-to-900-variables/m-p/180057#M265031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;do u mind explainng a little more detail on how to write the code? im a sas novice.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 15:32:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/making-same-changes-to-900-variables/m-p/180057#M265031</guid>
      <dc:creator>aarony</dc:creator>
      <dc:date>2015-02-24T15:32:04Z</dc:date>
    </item>
    <item>
      <title>Re: making same changes to 900 variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/making-same-changes-to-900-variables/m-p/180058#M265032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;supply example data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 15:36:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/making-same-changes-to-900-variables/m-p/180058#M265032</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2015-02-24T15:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: making same changes to 900 variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/making-same-changes-to-900-variables/m-p/180059#M265033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's a good tutorial on Arrays&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.ats.ucla.edu/stat/sas/seminars/SAS_arrays/" title="http://www.ats.ucla.edu/stat/sas/seminars/SAS_arrays/"&gt;Statistical Computing Seminar: Arrays in SAS&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 16:05:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/making-same-changes-to-900-variables/m-p/180059#M265033</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-02-24T16:05:35Z</dc:date>
    </item>
    <item>
      <title>Re: making same changes to 900 variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/making-same-changes-to-900-variables/m-p/180060#M265034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If ALL of your variables are character variables, and NONE have a name that is longer than 31 characters, and you want to change ALL of them to be numeric variables according to your stated recode statement, and you want to keep the same variable names, then you could use a data _null_ step with arrays to write and run call execute statements to accomplish the task.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If all of the above is true, then the following code can accomplish the task:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*create some example data*/&lt;/P&gt;&lt;P&gt; data j1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length this that something_else $12;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input (this that something_else) (&amp;amp; $);&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;1&amp;nbsp; y&amp;nbsp; n&lt;/P&gt;&lt;P&gt;na&amp;nbsp; n/a&amp;nbsp; 5&lt;/P&gt;&lt;P&gt;x&amp;nbsp; $$"ER", 9903&amp;nbsp; no&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*create and run some call execute statements*/&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set j1 (obs=1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; array all(*) _char_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length exline $200;&lt;/P&gt;&lt;P&gt;&amp;nbsp; call execute('data j2 (drop=_:); set j1 (rename=(');&lt;/P&gt;&lt;P&gt;&amp;nbsp; exline=catt(vname(all(1)),'=_',vname(all(1)));&lt;/P&gt;&lt;P&gt;&amp;nbsp; call execute(exline);&lt;/P&gt;&lt;P&gt;&amp;nbsp; do i=2 to dim(all);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exline=cat(' ',strip(vname(all(i))),'=_',strip(vname(all(i))));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call execute(exline);&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; call execute('));');&lt;/P&gt;&lt;P&gt;&amp;nbsp; do i=1 to dim(all);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exline=catt('if missing(_',vname(all(i)),') or upcase(_',&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; vname(all(i)),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ') in ("NO", "N", "NA", " ",',&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "'$$",'"ER", 9903',"') then do;",vname(all(i)),'=0;end;else do;',&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; vname(all(i)),'= 1; end;');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call execute(exline);&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; call execute('run;');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Feb 2015 17:53:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/making-same-changes-to-900-variables/m-p/180060#M265034</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2015-02-24T17:53:11Z</dc:date>
    </item>
  </channel>
</rss>

