<?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 Patients flagging question in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Patients-flagging-question/m-p/75927#M16361</link>
    <description>Howdy everyone&lt;BR /&gt;
&lt;BR /&gt;
Just wondering if anyone can help me with this problem&lt;BR /&gt;
&lt;BR /&gt;
Pat_id	ST-JO	NEPEA	PRINC	WESTM&lt;BR /&gt;
1	1	.	.	.&lt;BR /&gt;
2	1	.	1	.&lt;BR /&gt;
3	.	.	.	1&lt;BR /&gt;
4	.	1	.	.&lt;BR /&gt;
5	1	.	1	1&lt;BR /&gt;
6	.	1	1	.&lt;BR /&gt;
7	.	.	.	1&lt;BR /&gt;
8	.	1	.	1&lt;BR /&gt;
9	.	1	.	.&lt;BR /&gt;
10	1	.	.	.&lt;BR /&gt;
11	.	1	.	.&lt;BR /&gt;
12	1	.	.	.&lt;BR /&gt;
13	.	1	.	.&lt;BR /&gt;
14	.	.	1	.&lt;BR /&gt;
15	1	1	1	.&lt;BR /&gt;
&lt;BR /&gt;
I'm interested in having a solution like the data set below&lt;BR /&gt;
&lt;BR /&gt;
Pat_id	only_at_St_John	only_at_Nepean	only_at_PRINC	only_at_WESTM&lt;BR /&gt;
1	ONLY VISITED	NEVER VISITED	NEVER VISITED	NEVER VISITED&lt;BR /&gt;
2	MULTI	        MULTI	        MULTI	&lt;BR /&gt;
        MULTI&lt;BR /&gt;
3	NEVER VISITED	NEVER VISITED	NEVER VISITED	ONLY VISITED&lt;BR /&gt;
4	NEVER VISITED	ONLY VISITED	NEVER VISITED	NEVER VISITED&lt;BR /&gt;
5	MULTI	        MULTI	        MULTI	&lt;BR /&gt;
        MULTI&lt;BR /&gt;
6	MULTI	        MULTI	        MULTI	&lt;BR /&gt;
        MULTI&lt;BR /&gt;
7	NEVER VISITED	NEVER VISITED	NEVER VISITED	ONLY VISITED&lt;BR /&gt;
8	MULTI	        MULTI	        MULTI	&lt;BR /&gt;
        MULTI&lt;BR /&gt;
9	NEVER VISITED	ONLY VISITED	NEVER VISITED	NEVER VISITED&lt;BR /&gt;
10	ONLY VISITED	NEVER VISITED	NEVER VISITED	NEVER VISITED&lt;BR /&gt;
11	NEVER VISITED	ONLY VISITED	NEVER VISITED	NEVER VISITED&lt;BR /&gt;
12	ONLY VISITED	NEVER VISITED	NEVER VISITED	NEVER VISITED&lt;BR /&gt;
13	NEVER VISITED	ONLY VISITED	NEVER VISITED	NEVER VISITED&lt;BR /&gt;
14	NEVER VISITED	NEVER VISITED	ONLY VISITED	NEVER VISITED&lt;BR /&gt;
15	MULTI	        MULTI	        MULTI	&lt;BR /&gt;
        MULTI&lt;BR /&gt;
&lt;BR /&gt;
Thank you

Message was edited by: DonaldH</description>
    <pubDate>Thu, 15 Oct 2009 07:24:38 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-10-15T07:24:38Z</dc:date>
    <item>
      <title>Patients flagging question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Patients-flagging-question/m-p/75927#M16361</link>
      <description>Howdy everyone&lt;BR /&gt;
&lt;BR /&gt;
Just wondering if anyone can help me with this problem&lt;BR /&gt;
&lt;BR /&gt;
Pat_id	ST-JO	NEPEA	PRINC	WESTM&lt;BR /&gt;
1	1	.	.	.&lt;BR /&gt;
2	1	.	1	.&lt;BR /&gt;
3	.	.	.	1&lt;BR /&gt;
4	.	1	.	.&lt;BR /&gt;
5	1	.	1	1&lt;BR /&gt;
6	.	1	1	.&lt;BR /&gt;
7	.	.	.	1&lt;BR /&gt;
8	.	1	.	1&lt;BR /&gt;
9	.	1	.	.&lt;BR /&gt;
10	1	.	.	.&lt;BR /&gt;
11	.	1	.	.&lt;BR /&gt;
12	1	.	.	.&lt;BR /&gt;
13	.	1	.	.&lt;BR /&gt;
14	.	.	1	.&lt;BR /&gt;
15	1	1	1	.&lt;BR /&gt;
&lt;BR /&gt;
I'm interested in having a solution like the data set below&lt;BR /&gt;
&lt;BR /&gt;
Pat_id	only_at_St_John	only_at_Nepean	only_at_PRINC	only_at_WESTM&lt;BR /&gt;
1	ONLY VISITED	NEVER VISITED	NEVER VISITED	NEVER VISITED&lt;BR /&gt;
2	MULTI	        MULTI	        MULTI	&lt;BR /&gt;
        MULTI&lt;BR /&gt;
3	NEVER VISITED	NEVER VISITED	NEVER VISITED	ONLY VISITED&lt;BR /&gt;
4	NEVER VISITED	ONLY VISITED	NEVER VISITED	NEVER VISITED&lt;BR /&gt;
5	MULTI	        MULTI	        MULTI	&lt;BR /&gt;
        MULTI&lt;BR /&gt;
6	MULTI	        MULTI	        MULTI	&lt;BR /&gt;
        MULTI&lt;BR /&gt;
7	NEVER VISITED	NEVER VISITED	NEVER VISITED	ONLY VISITED&lt;BR /&gt;
8	MULTI	        MULTI	        MULTI	&lt;BR /&gt;
        MULTI&lt;BR /&gt;
9	NEVER VISITED	ONLY VISITED	NEVER VISITED	NEVER VISITED&lt;BR /&gt;
10	ONLY VISITED	NEVER VISITED	NEVER VISITED	NEVER VISITED&lt;BR /&gt;
11	NEVER VISITED	ONLY VISITED	NEVER VISITED	NEVER VISITED&lt;BR /&gt;
12	ONLY VISITED	NEVER VISITED	NEVER VISITED	NEVER VISITED&lt;BR /&gt;
13	NEVER VISITED	ONLY VISITED	NEVER VISITED	NEVER VISITED&lt;BR /&gt;
14	NEVER VISITED	NEVER VISITED	ONLY VISITED	NEVER VISITED&lt;BR /&gt;
15	MULTI	        MULTI	        MULTI	&lt;BR /&gt;
        MULTI&lt;BR /&gt;
&lt;BR /&gt;
Thank you

Message was edited by: DonaldH</description>
      <pubDate>Thu, 15 Oct 2009 07:24:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Patients-flagging-question/m-p/75927#M16361</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-10-15T07:24:38Z</dc:date>
    </item>
    <item>
      <title>Re: Patients flagging question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Patients-flagging-question/m-p/75928#M16362</link>
      <description>PROC FORMAT ;&lt;BR /&gt;
*creating a translation from missing and 1 to visits string; [pre]  value visits  &lt;BR /&gt;
      1 ='ONLY VISITED'&lt;BR /&gt;
      . = 'NEVER VISITED' &lt;BR /&gt;
      2-high = 'MULTI'     ;&lt;BR /&gt;
run ;&lt;BR /&gt;
proc print data= your_data ;&lt;BR /&gt;
   id Pat_id ;&lt;BR /&gt;
   format _numeric_ visits. pat_id best8. ;&lt;BR /&gt;
run ;     [/pre] &lt;BR /&gt;
PeterC

Sorry I misunderstood!&lt;BR /&gt;
If more than one location, then all MULTI &lt;BR /&gt;
So I've provided the wrong solution.... better later&lt;BR /&gt;
&lt;BR /&gt;
    &lt;BR /&gt;
Message was edited by: Peter.C</description>
      <pubDate>Thu, 15 Oct 2009 08:10:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Patients-flagging-question/m-p/75928#M16362</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2009-10-15T08:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: Patients flagging question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Patients-flagging-question/m-p/75929#M16363</link>
      <description>Peter's solution will work if you first multiply each value by the sum of all of them.&lt;BR /&gt;
&lt;BR /&gt;
ie. ST-Jo = st-JO * sum(ST-JO, NEPEA, PRINC, WESTM)</description>
      <pubDate>Thu, 15 Oct 2009 12:07:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Patients-flagging-question/m-p/75929#M16363</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2009-10-15T12:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: Patients flagging question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Patients-flagging-question/m-p/75930#M16364</link>
      <description>alternately, apply this transform to the attendance record&lt;BR /&gt;
(add rather than multiply)&lt;BR /&gt;
   array thos(*) ST-JO NEPEA PRINC WESTM ; &lt;BR /&gt;
   if n( of thos(*) ) &amp;gt;1 then do _i_=1 to dim(thos) ;&lt;BR /&gt;
      thos(i) +2 ;&lt;BR /&gt;
   end ;&lt;BR /&gt;
 that allows those that were attended, still to be distinguished.&lt;BR /&gt;
 &lt;BR /&gt;
and follow up with the print subject to the formatting &lt;BR /&gt;
&lt;BR /&gt;
PeterC</description>
      <pubDate>Thu, 15 Oct 2009 13:42:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Patients-flagging-question/m-p/75930#M16364</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2009-10-15T13:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: Patients flagging question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Patients-flagging-question/m-p/75931#M16365</link>
      <description>My apology Peter but I can't quite figure out how to implement your solution in my code, do I apply the format to the array thos?</description>
      <pubDate>Thu, 15 Oct 2009 23:49:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Patients-flagging-question/m-p/75931#M16365</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-10-15T23:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: Patients flagging question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Patients-flagging-question/m-p/75932#M16366</link>
      <description>you can apply formats to variables, but not arraynames. &lt;BR /&gt;
proc print data= your_updated_data ;&lt;BR /&gt;
    id Pat_id ; &lt;BR /&gt;
  format ST_JO NEPEA PRINC WESTM  visits. ;      &lt;BR /&gt;
run ;</description>
      <pubDate>Sat, 17 Oct 2009 17:19:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Patients-flagging-question/m-p/75932#M16366</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2009-10-17T17:19:57Z</dc:date>
    </item>
    <item>
      <title>Re: Patients flagging question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Patients-flagging-question/m-p/75933#M16367</link>
      <description>Hi Peter I did what you suggested but the 'MULTI' records did not come out quite right, did I do anything wrong here?</description>
      <pubDate>Mon, 19 Oct 2009 00:19:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Patients-flagging-question/m-p/75933#M16367</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-10-19T00:19:27Z</dc:date>
    </item>
    <item>
      <title>Re: Patients flagging question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Patients-flagging-question/m-p/75934#M16368</link>
      <description>Donald H&lt;BR /&gt;
I can almost debug blind ;-), but sas logs help&lt;BR /&gt;
 &lt;BR /&gt;
Would you like me to guess(see below), or provide your versions ........&amp;gt; &lt;BR /&gt;
 &lt;BR /&gt;
1 &amp;gt; provide : a sas-code showing what doesn't work&lt;BR /&gt;
+&lt;BR /&gt;
2 &amp;gt; provide : the sas-log showing what the sas system thought of the code, &lt;BR /&gt;
+&lt;BR /&gt;
3 &amp;gt; provide : the output, if any &lt;BR /&gt;
&lt;BR /&gt;
PeterC&lt;BR /&gt;
 &lt;BR /&gt;
 &lt;BR /&gt;
 &lt;BR /&gt;
 &lt;BR /&gt;
 &lt;BR /&gt;
 &lt;BR /&gt;
 &lt;BR /&gt;
 &lt;BR /&gt;
data orig ;&lt;BR /&gt;
input Pat_id ST_JO NEPEA PRINC WESTM ;&lt;BR /&gt;
list;cards;&lt;BR /&gt;
1 1 . . .&lt;BR /&gt;
2 1 . 1 .&lt;BR /&gt;
3 . . . 1&lt;BR /&gt;
4 . 1 . .&lt;BR /&gt;
5 1 . 1 1&lt;BR /&gt;
6 . 1 1 .&lt;BR /&gt;
7 . . . 1&lt;BR /&gt;
8 . 1 . 1&lt;BR /&gt;
9 . 1 . .&lt;BR /&gt;
10 1 . . .&lt;BR /&gt;
11 . 1 . .&lt;BR /&gt;
12 1 . . .&lt;BR /&gt;
13 . 1 . .&lt;BR /&gt;
14 . . 1 .&lt;BR /&gt;
15 1 1 1 .&lt;BR /&gt;
;&lt;BR /&gt;
&lt;BR /&gt;
PROC FORMAT ;&lt;BR /&gt;
*creating a translation from missing and 1 to visits string; &lt;BR /&gt;
  value visits  &lt;BR /&gt;
      1 ='ONLY VISITED'&lt;BR /&gt;
      . = 'NEVER VISITED' &lt;BR /&gt;
      2-high = 'MULTI'     ;&lt;BR /&gt;
run ;&lt;BR /&gt;
proc print data= orig ;&lt;BR /&gt;
   id Pat_id ;&lt;BR /&gt;
   format _numeric_ visits. pat_id best8. ;&lt;BR /&gt;
run ;   &lt;BR /&gt;
data your_updated_data ;&lt;BR /&gt;
    set ;&lt;BR /&gt;
    array thos(*) ST_JO NEPEA PRINC WESTM ; &lt;BR /&gt;
    if n( of thos(*) ) &amp;gt;1 then &lt;BR /&gt;
    do _i_=1 to dim(thos) ;&lt;BR /&gt;
        thos(_i_) +2 ;&lt;BR /&gt;
    end ;&lt;BR /&gt;
    format        ST_JO NEPEA PRINC WESTM  visits. ;&lt;BR /&gt;
run ;&lt;BR /&gt;
proc print ;&lt;BR /&gt;
run ;

Message was edited by: Peter.C</description>
      <pubDate>Mon, 19 Oct 2009 16:11:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Patients-flagging-question/m-p/75934#M16368</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2009-10-19T16:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: Patients flagging question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Patients-flagging-question/m-p/75935#M16369</link>
      <description>PROC FORMAT ;&lt;BR /&gt;
  value visits  &lt;BR /&gt;
      1 ='ONLY VISITED'&lt;BR /&gt;
      . = 'NEVER VISITED' ;&lt;BR /&gt;
 run ;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data newdata;&lt;BR /&gt;
set yourdata;&lt;BR /&gt;
drop i;&lt;BR /&gt;
array thos(4) ST_JO NEPEA PRINC WESTM;&lt;BR /&gt;
array new(4) $14. only_at_St_John only_at_Nepean only_at_PRINC only_at_WESTM;&lt;BR /&gt;
if n( of org(*) ) &amp;gt;1 then do i=1 to 4;&lt;BR /&gt;
new(i)="MULTI";&lt;BR /&gt;
end;&lt;BR /&gt;
else do i=1 to 4;&lt;BR /&gt;
new(i)=put(org(i),visits.);&lt;BR /&gt;
end;&lt;BR /&gt;
run;</description>
      <pubDate>Mon, 19 Oct 2009 16:15:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Patients-flagging-question/m-p/75935#M16369</guid>
      <dc:creator>SUN59338</dc:creator>
      <dc:date>2009-10-19T16:15:14Z</dc:date>
    </item>
  </channel>
</rss>

