<?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: Hospital visit problem in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Hospital-visit-problem/m-p/7773#M135</link>
    <description>Thank you Chris and Scott for your help.&lt;BR /&gt;
&lt;BR /&gt;
Sorry to bring the bad news but there has been a change of plan.&lt;BR /&gt;
&lt;BR /&gt;
My data now includes an additional column of the hospital the patient visited and I need the following summary.&lt;BR /&gt;
&lt;BR /&gt;
	         Last month   last 6 months last 1 year  Total Patients&lt;BR /&gt;
ST-JOHN	         50	            40	                 30	   120&lt;BR /&gt;
WESTMEAD      60	            40	                 20	   120&lt;BR /&gt;
CONCORD         30	            20	                 10	    60&lt;BR /&gt;
PRINCE             80	            60	                 40	  180&lt;BR /&gt;
OF WALES	&lt;BR /&gt;
&lt;BR /&gt;
Many thanks for your help.</description>
    <pubDate>Thu, 29 Oct 2009 02:01:21 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-10-29T02:01:21Z</dc:date>
    <item>
      <title>Hospital visit problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hospital-visit-problem/m-p/7770#M132</link>
      <description>Howdy all, I was given a data set that is bigger than the 1 millions rows that Excel 2007 can handle and I have no other option except doing this in SAS. My data set looks like this, where month 1,2 &amp;amp; 3 are the rolling month period which I need to set up like a macro variable.&lt;BR /&gt;
&lt;BR /&gt;
PAT_ID	month 1	month 2	month 3&lt;BR /&gt;
1	0	1	2&lt;BR /&gt;
2	1	1	2&lt;BR /&gt;
3	2	0	1&lt;BR /&gt;
4	0	0	3&lt;BR /&gt;
5	3	0	0&lt;BR /&gt;
6	0	0	2&lt;BR /&gt;
7	0	2	0&lt;BR /&gt;
8	0	2	2&lt;BR /&gt;
&lt;BR /&gt;
and the end result something like below&lt;BR /&gt;
&lt;BR /&gt;
PAT_ID	month 1	month 2	month 3&lt;BR /&gt;
1	.	3	.&lt;BR /&gt;
2	4	.	.&lt;BR /&gt;
3	3	.	.&lt;BR /&gt;
4	.	.	3&lt;BR /&gt;
5	3	.	&lt;BR /&gt;
6	.		4&lt;BR /&gt;
7		2	.&lt;BR /&gt;
8	.	4	.&lt;BR /&gt;
&lt;BR /&gt;
TIA&lt;BR /&gt;
&lt;BR /&gt;
Don</description>
      <pubDate>Tue, 27 Oct 2009 07:09:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hospital-visit-problem/m-p/7770#M132</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-10-27T07:09:59Z</dc:date>
    </item>
    <item>
      <title>Re: Hospital visit problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hospital-visit-problem/m-p/7771#M133</link>
      <description>Using a DATA step with an ARRAY and an IF/THEN statement, test for a zero value and reset the variable to a missing value.  The ARRAY can reference the variable prefix for your "month n" variables and use DO I=1 to DIM(&lt;ARRAYNAME&gt;); END;  to reset the value.&lt;BR /&gt;
&lt;BR /&gt;
The SAS support  &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website has SAS-hosted documentation and supplemental technical and conference reference material -- you can use its SEARCH facility or use a Google advanced search (add the site:sas.com to limit the search) using keywords.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
DATA Step Processing&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a001281588.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a001281588.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
SAS Language Reference: Concepts - Array Processing&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a002299816.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a002299816.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Using SAS® Arrays to Manipulate Data&lt;BR /&gt;
Ben Cochran, The Bedford Group, Raleigh, NC&lt;BR /&gt;
&lt;A href="http://support.sas.com/resources/papers/proceedings09/032-2009.pdfPaper" target="_blank"&gt;http://support.sas.com/resources/papers/proceedings09/032-2009.pdfPaper&lt;/A&gt; 032-2009&lt;/ARRAYNAME&gt;</description>
      <pubDate>Tue, 27 Oct 2009 07:38:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hospital-visit-problem/m-p/7771#M133</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-10-27T07:38:50Z</dc:date>
    </item>
    <item>
      <title>Re: Hospital visit problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hospital-visit-problem/m-p/7772#M134</link>
      <description>Use Scott's links to understand the following:&lt;BR /&gt;
&lt;BR /&gt;
[pre]data OUT;&lt;BR /&gt;
  input PAT_ID MONTH1 MONTH2 MONTH3; * can be written   input PAT_ID (MONTH1-MONTH3)(:);&lt;BR /&gt;
&lt;BR /&gt;
  if MONTH1 then do;&lt;BR /&gt;
    MONTH1=sum(of MONTH1-MONTH3);&lt;BR /&gt;
    call missing(MONTH2, MONTH3);&lt;BR /&gt;
  end;&lt;BR /&gt;
  else if MONTH2 then do;&lt;BR /&gt;
    MONTH2=sum(of MONTH1-MONTH3);&lt;BR /&gt;
    call missing(MONTH1, MONTH3);&lt;BR /&gt;
  end;&lt;BR /&gt;
  else if MONTH3 then do;&lt;BR /&gt;
    MONTH3=sum(of MONTH1-MONTH3);&lt;BR /&gt;
    call missing(MONTH1, MONTH2);&lt;BR /&gt;
  end;&lt;BR /&gt;
  else call missing(of MONTH1-MONTH3);&lt;BR /&gt;
cards;&lt;BR /&gt;
1 0 1 2&lt;BR /&gt;
2 1 1 2&lt;BR /&gt;
3 2 0 1&lt;BR /&gt;
4 0 0 3&lt;BR /&gt;
5 3 0 0&lt;BR /&gt;
6 0 0 2&lt;BR /&gt;
7 0 2 0&lt;BR /&gt;
8 0 2 2&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
If you had many months, you'd loop thru them using an array, as Scott said, rather than adding tests.&lt;BR /&gt;
&lt;BR /&gt;
One step at a time though.</description>
      <pubDate>Wed, 28 Oct 2009 02:46:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hospital-visit-problem/m-p/7772#M134</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2009-10-28T02:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: Hospital visit problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hospital-visit-problem/m-p/7773#M135</link>
      <description>Thank you Chris and Scott for your help.&lt;BR /&gt;
&lt;BR /&gt;
Sorry to bring the bad news but there has been a change of plan.&lt;BR /&gt;
&lt;BR /&gt;
My data now includes an additional column of the hospital the patient visited and I need the following summary.&lt;BR /&gt;
&lt;BR /&gt;
	         Last month   last 6 months last 1 year  Total Patients&lt;BR /&gt;
ST-JOHN	         50	            40	                 30	   120&lt;BR /&gt;
WESTMEAD      60	            40	                 20	   120&lt;BR /&gt;
CONCORD         30	            20	                 10	    60&lt;BR /&gt;
PRINCE             80	            60	                 40	  180&lt;BR /&gt;
OF WALES	&lt;BR /&gt;
&lt;BR /&gt;
Many thanks for your help.</description>
      <pubDate>Thu, 29 Oct 2009 02:01:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hospital-visit-problem/m-p/7773#M135</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-10-29T02:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: Hospital visit problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hospital-visit-problem/m-p/7774#M136</link>
      <description>Given the feedback to-date, I would recommend you attempt to make any necessary SAS code changes, re-post your modified code (after your own testing), and seek feedback again if you have difficulties or questions.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Thu, 29 Oct 2009 12:20:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hospital-visit-problem/m-p/7774#M136</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-10-29T12:20:01Z</dc:date>
    </item>
    <item>
      <title>Re: Hospital visit problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hospital-visit-problem/m-p/7775#M137</link>
      <description>Agreed, please give it a try and grow your knowledge.</description>
      <pubDate>Fri, 30 Oct 2009 00:38:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hospital-visit-problem/m-p/7775#M137</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2009-10-30T00:38:07Z</dc:date>
    </item>
  </channel>
</rss>

