<?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: I have more than 80 variables for patients with multiple ID . in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/I-have-more-than-80-variables-for-patients-with-multiple-ID/m-p/888506#M39462</link>
    <description>Here's one approach.   &lt;BR /&gt;&lt;BR /&gt;proc summary data=have nway;&lt;BR /&gt;var da -- gd;&lt;BR /&gt;by id;&lt;BR /&gt;output out=maxvals max=;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;For that step, use the name of the last variable instead of gd.  Then merge these maximum values back into the original data:&lt;BR /&gt;&lt;BR /&gt;data want;&lt;BR /&gt;merge maxvals (drop= _type_ _freq_) have (keep = id);&lt;BR /&gt;by id;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;SQL supports similar features.  But it doesn't support lists of variables.   So it would force you to type out the complete list of variable names.</description>
    <pubDate>Wed, 09 Aug 2023 06:37:34 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2023-08-09T06:37:34Z</dc:date>
    <item>
      <title>I have more than 80 variables for patients with multiple ID .</title>
      <link>https://communities.sas.com/t5/New-SAS-User/I-have-more-than-80-variables-for-patients-with-multiple-ID/m-p/888494#M39457</link>
      <description>&lt;P&gt;I have more than 80 variables for patients with multiple ID&amp;nbsp; .&amp;nbsp;&lt;/P&gt;&lt;P&gt;the data looks like:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;da&lt;/TD&gt;&lt;TD&gt;aw&lt;/TD&gt;&lt;TD&gt;gd&lt;/TD&gt;&lt;TD&gt;etc.&amp;nbsp;&lt;/TD&gt;&lt;/T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sp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Wed, 09 Aug 2023 03:10:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/I-have-more-than-80-variables-for-patients-with-multiple-ID/m-p/888494#M39457</guid>
      <dc:creator>HijB</dc:creator>
      <dc:date>2023-08-09T03:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: I have more than 80 variables for patients with multiple ID .</title>
      <link>https://communities.sas.com/t5/New-SAS-User/I-have-more-than-80-variables-for-patients-with-multiple-ID/m-p/888506#M39462</link>
      <description>Here's one approach.   &lt;BR /&gt;&lt;BR /&gt;proc summary data=have nway;&lt;BR /&gt;var da -- gd;&lt;BR /&gt;by id;&lt;BR /&gt;output out=maxvals max=;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;For that step, use the name of the last variable instead of gd.  Then merge these maximum values back into the original data:&lt;BR /&gt;&lt;BR /&gt;data want;&lt;BR /&gt;merge maxvals (drop= _type_ _freq_) have (keep = id);&lt;BR /&gt;by id;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;SQL supports similar features.  But it doesn't support lists of variables.   So it would force you to type out the complete list of variable names.</description>
      <pubDate>Wed, 09 Aug 2023 06:37:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/I-have-more-than-80-variables-for-patients-with-multiple-ID/m-p/888506#M39462</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2023-08-09T06:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: I have more than 80 variables for patients with multiple ID .</title>
      <link>https://communities.sas.com/t5/New-SAS-User/I-have-more-than-80-variables-for-patients-with-multiple-ID/m-p/888556#M39471</link>
      <description>&lt;P&gt;Thank you for your response, I did not mention earlier than I also have around 4 million observations, merging any file takes time and freezes the software, is there a way around it?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2023 12:43:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/I-have-more-than-80-variables-for-patients-with-multiple-ID/m-p/888556#M39471</guid>
      <dc:creator>HijB</dc:creator>
      <dc:date>2023-08-09T12:43:05Z</dc:date>
    </item>
    <item>
      <title>Re: I have more than 80 variables for patients with multiple ID .</title>
      <link>https://communities.sas.com/t5/New-SAS-User/I-have-more-than-80-variables-for-patients-with-multiple-ID/m-p/888559#M39472</link>
      <description>&lt;P&gt;The data step merge usually doesn't require much computer resorrces, like sorting, SQL joins and aggregation steps.&lt;/P&gt;
&lt;P&gt;So the questions is what's going on in your computer?&lt;/P&gt;
&lt;P&gt;Make sure you have the necessary space for your saswork location.&lt;/P&gt;
&lt;P&gt;Check any Windows logs for messages, and also Task Manager while executing your step.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2023 12:53:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/I-have-more-than-80-variables-for-patients-with-multiple-ID/m-p/888559#M39472</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2023-08-09T12:53:16Z</dc:date>
    </item>
    <item>
      <title>Re: I have more than 80 variables for patients with multiple ID .</title>
      <link>https://communities.sas.com/t5/New-SAS-User/I-have-more-than-80-variables-for-patients-with-multiple-ID/m-p/888706#M39473</link>
      <description>&lt;P&gt;Buy a new computer?&amp;nbsp; Pretty much any computer built in the last 10 years could handle this amount of data in less than a minute.&amp;nbsp; So try it this way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Take a subset of your data (let's say ID values of 1, 2, and 3).&amp;nbsp; Get the program working for that subset.&amp;nbsp; Once you have a working program, try applying it to the full data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2023 01:20:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/I-have-more-than-80-variables-for-patients-with-multiple-ID/m-p/888706#M39473</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2023-08-10T01:20:53Z</dc:date>
    </item>
    <item>
      <title>Re: I have more than 80 variables for patients with multiple ID .</title>
      <link>https://communities.sas.com/t5/New-SAS-User/I-have-more-than-80-variables-for-patients-with-multiple-ID/m-p/888717#M39474</link>
      <description>&lt;P&gt;Why do you want to keep n obs for each patient all having the same data?&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2023 04:55:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/I-have-more-than-80-variables-for-patients-with-multiple-ID/m-p/888717#M39474</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2023-08-10T04:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: I have more than 80 variables for patients with multiple ID .</title>
      <link>https://communities.sas.com/t5/New-SAS-User/I-have-more-than-80-variables-for-patients-with-multiple-ID/m-p/889018#M39492</link>
      <description>&lt;P&gt;this is a new computer I only had it for a month but every time I run the whole dataset the sas software not the computer freezes.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Aug 2023 02:39:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/I-have-more-than-80-variables-for-patients-with-multiple-ID/m-p/889018#M39492</guid>
      <dc:creator>HijB</dc:creator>
      <dc:date>2023-08-12T02:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: I have more than 80 variables for patients with multiple ID .</title>
      <link>https://communities.sas.com/t5/New-SAS-User/I-have-more-than-80-variables-for-patients-with-multiple-ID/m-p/889140#M39503</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/446556"&gt;@HijB&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;this is a new computer I only had it for a month but every time I run the whole dataset the sas software not the computer freezes.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Strange, this should not happen. Are the latest updates applied to the sas installation? How much memory is installed?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2023 05:47:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/I-have-more-than-80-variables-for-patients-with-multiple-ID/m-p/889140#M39503</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2023-08-14T05:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: I have more than 80 variables for patients with multiple ID .</title>
      <link>https://communities.sas.com/t5/New-SAS-User/I-have-more-than-80-variables-for-patients-with-multiple-ID/m-p/889148#M39504</link>
      <description>&lt;P&gt;Double DOW-loop can do it too:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input ID	da	aw	gd;
cards;
1	1	.	.	 
1	.	1	.	 
1	.	1	.	 
1	.	.	.	 
2	.	1	1	 
2	.	.	1	 
3	.	.	.	 
3	1	.	.	 
3	.	.	.	 
;
run;
proc print;
run;


%let list_of_vars = da aw gd;
%let num_of_vars = 3;

data want;
  do until(last.ID);
    set have;
    by ID;

    array V(i) &amp;amp;list_of_vars.;
    array T [&amp;amp;num_of_vars.]; 
    drop t:;

    do over V;
      t[i] = V &amp;lt;&amp;gt; t[i];
    end;
  end;

  do over V;
    V = t[i];
  end;

  do until(last.ID);
    set have(drop=&amp;amp;list_of_vars.);
    by ID;
    output;
  end;
run;
proc print;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2023 06:59:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/I-have-more-than-80-variables-for-patients-with-multiple-ID/m-p/889148#M39504</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-08-14T06:59:52Z</dc:date>
    </item>
  </channel>
</rss>

