<?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: Pattern? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Pattern/m-p/58108#M12605</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You say assignment, thus can we assume homework assignment?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If so, most people here don't mind helping, but only if you try.&amp;nbsp; And, of course, no one here would know what you have been taught and how complex of an answer you can handle.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you look at your data, for each subject, the doses follow the DosingPattern you want to end up with and the endmonth-startmonth for each matches your DosingTime desired entries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This could be done, minimally, in a datastep or with proc sql.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you do it with a datastep, one way would be to use a by Subject dose statement, first.dose and last.dose variables to know when you've got the starting and ending information, a retain statement to retain the desired variables you are trying to create, as well as to retain the DosingTime sums.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does any of that make sense to you?&amp;nbsp; If it does, try to write the code and, if you run into a problem, ask a more specific question as to how you would have to correct "your" code to get it to work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 07 Apr 2012 21:15:08 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2012-04-07T21:15:08Z</dc:date>
    <item>
      <title>Pattern?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pattern/m-p/58107#M12604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All - &lt;/P&gt;&lt;P&gt;I'm working on an assignment that requires me to get the output below from data testing. I'm not even sure where to start. Anyone have any suggestions / techniques?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;SPAN style="color: #000080; font-size: 12pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New';"&gt; testing;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #500050; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; font-family: 'Courier New'; color: blue; background-color: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New';"&gt; subject dose startmonth endmonth;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #500050; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New'; color: blue; background-color: white;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #500050; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;SPAN style="background-color: #ffffc0; font-size: 10pt; font-family: 'Courier New';"&gt;1&amp;nbsp; 25&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp; 3&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #500050; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;SPAN style="background-color: #ffffc0; font-size: 10pt; font-family: 'Courier New';"&gt;1&amp;nbsp; 25&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp; 5&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #500050; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;SPAN style="background-color: #ffffc0; font-size: 10pt; font-family: 'Courier New';"&gt;1&amp;nbsp; 50&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp; 7&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #500050; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;SPAN style="background-color: #ffffc0; font-size: 10pt; font-family: 'Courier New';"&gt;1&amp;nbsp; 50&amp;nbsp;&amp;nbsp; 7&amp;nbsp;&amp;nbsp; 9&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #500050; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;SPAN style="background-color: #ffffc0; font-size: 10pt; font-family: 'Courier New';"&gt;1&amp;nbsp; 50&amp;nbsp;&amp;nbsp; 9&amp;nbsp;&amp;nbsp; 12&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #500050; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;SPAN style="background-color: #ffffc0; font-size: 10pt; font-family: 'Courier New';"&gt;1&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp; 12&amp;nbsp; 14&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #500050; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;SPAN style="background-color: #ffffc0; font-size: 10pt; font-family: 'Courier New';"&gt;1&amp;nbsp; 25&amp;nbsp;&amp;nbsp; 14&amp;nbsp; 16&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #500050; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;SPAN style="background-color: #ffffc0; font-size: 10pt; font-family: 'Courier New';"&gt;2&amp;nbsp; 50&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp; 3&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #500050; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;SPAN style="background-color: #ffffc0; font-size: 10pt; font-family: 'Courier New';"&gt;2&amp;nbsp; 50&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp; 5&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #500050; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;SPAN style="background-color: #ffffc0; font-size: 10pt; font-family: 'Courier New';"&gt;2&amp;nbsp; 25&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp; 7&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #500050; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;SPAN style="background-color: #ffffc0; font-size: 10pt; font-family: 'Courier New';"&gt;2&amp;nbsp; 25&amp;nbsp;&amp;nbsp; 7&amp;nbsp;&amp;nbsp; 9&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #500050; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;SPAN style="background-color: #ffffc0; font-size: 10pt; font-family: 'Courier New';"&gt;2&amp;nbsp; 50&amp;nbsp;&amp;nbsp; 9&amp;nbsp;&amp;nbsp; 12&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #500050; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;SPAN style="background-color: #ffffc0; font-size: 10pt; font-family: 'Courier New';"&gt;2&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp; 12&amp;nbsp; 14&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #500050; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;SPAN style="background-color: #ffffc0; font-size: 10pt; font-family: 'Courier New';"&gt;2&amp;nbsp; .&amp;nbsp;&amp;nbsp; 14&amp;nbsp; 16&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #500050; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #500050; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="background-color: white; font-size: 10pt; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #500050; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New'; color: green; background-color: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #500050; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;SPAN style="font-size: 12pt; color: navy; background-color: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #500050; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;SPAN style="font-size: 12pt; color: navy; background-color: yellow;"&gt;Output that I’m trying to get:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #500050; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New'; color: green; background-color: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #500050; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New'; color: green; background-color: white;"&gt;Subject&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DosingPattern&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DosingTime&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #500050; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New'; color: green; background-color: white;"&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 25#50#.#25&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5#7#2#2&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #500050; font-family: arial, sans-serif; text-align: -webkit-auto; background-color: rgba(255, 255, 255, 0.917969);"&gt;&lt;SPAN style="font-size: 10pt; font-family: 'Courier New'; color: green; background-color: white;"&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 50#25#50#.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5#4#3#4&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Apr 2012 20:51:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pattern/m-p/58107#M12604</guid>
      <dc:creator>danielle</dc:creator>
      <dc:date>2012-04-07T20:51:18Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pattern/m-p/58108#M12605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You say assignment, thus can we assume homework assignment?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If so, most people here don't mind helping, but only if you try.&amp;nbsp; And, of course, no one here would know what you have been taught and how complex of an answer you can handle.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you look at your data, for each subject, the doses follow the DosingPattern you want to end up with and the endmonth-startmonth for each matches your DosingTime desired entries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This could be done, minimally, in a datastep or with proc sql.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you do it with a datastep, one way would be to use a by Subject dose statement, first.dose and last.dose variables to know when you've got the starting and ending information, a retain statement to retain the desired variables you are trying to create, as well as to retain the DosingTime sums.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does any of that make sense to you?&amp;nbsp; If it does, try to write the code and, if you run into a problem, ask a more specific question as to how you would have to correct "your" code to get it to work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Apr 2012 21:15:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pattern/m-p/58108#M12605</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-04-07T21:15:08Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pattern/m-p/58109#M12606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your assignment is easy. I think I will be blamed by Art.T . &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data testing;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input subject dose startmonth endmonth;
cards;
1&amp;nbsp; 25&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp; 3
1&amp;nbsp; 25&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp; 5
1&amp;nbsp; 50&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp; 7
1&amp;nbsp; 50&amp;nbsp;&amp;nbsp; 7&amp;nbsp;&amp;nbsp; 9
1&amp;nbsp; 50&amp;nbsp;&amp;nbsp; 9&amp;nbsp;&amp;nbsp; 12
1&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp; 12&amp;nbsp; 14
1&amp;nbsp; 25&amp;nbsp;&amp;nbsp; 14&amp;nbsp; 16
2&amp;nbsp; 50&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp; 3
2&amp;nbsp; 50&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp; 5
2&amp;nbsp; 25&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp; 7
2&amp;nbsp; 25&amp;nbsp;&amp;nbsp; 7&amp;nbsp;&amp;nbsp; 9
2&amp;nbsp; 50&amp;nbsp;&amp;nbsp; 9&amp;nbsp;&amp;nbsp; 12
2&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp; 12&amp;nbsp; 14
2&amp;nbsp; .&amp;nbsp;&amp;nbsp; 14&amp;nbsp; 16
;
run;
data x(keep=subject dose duration);
 set testing;
 by subject dose notsorted;
 retain start;
 if first.dose then start=startmonth;
 if last.dose then do;duration=endmonth-start;output;end;
run;
data want(keep=subject pattern time);
 set x;
 by subject notsorted;
 length pattern time $ 400;
 retain pattern time;
 pattern=catx('#',pattern,dose);
 time=catx('#',time,duration);
 if last.subject then do;output;call missing(pattern,time);end;
run;



&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Apr 2012 05:54:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pattern/m-p/58109#M12606</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-04-09T05:54:08Z</dc:date>
    </item>
  </channel>
</rss>

