<?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: Proc Compare Result-between Proc SQL and Proc Transpose not matching, getting different results in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Compare-Result-between-Proc-SQL-and-Proc-Transpose-not/m-p/771754#M244963</link>
    <description>Great.&lt;BR /&gt;If you can share your observation on the forum that may help others.&lt;BR /&gt;</description>
    <pubDate>Sat, 02 Oct 2021 12:56:04 GMT</pubDate>
    <dc:creator>Sajid01</dc:creator>
    <dc:date>2021-10-02T12:56:04Z</dc:date>
    <item>
      <title>Proc Compare Result-between Proc SQL and Proc Transpose not matching, getting different results Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Compare-Result-between-Proc-SQL-and-Proc-Transpose-not/m-p/771192#M244682</link>
      <description>&lt;P&gt;data have;&lt;BR /&gt;length epoch $10. ;&lt;BR /&gt;input usubjid sstdtc sendtc epoch $ count;&lt;BR /&gt;informat sstdtc date9. sendtc date9.;&lt;BR /&gt;format sstdtc sendtc yymmdd10.;&lt;BR /&gt;datalines;&lt;BR /&gt;100 01JAN2010 15JAN2010 Screening 1&lt;BR /&gt;100 15JAN2010 15JUL2010 Treatment 2&lt;BR /&gt;100 16JUL2010 20DEC2010 Follow-up 3&lt;/P&gt;&lt;P&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sort data = have out = have_sort;&lt;BR /&gt;by usubjid count;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data have1;&lt;BR /&gt;input usubjid adtc ;&lt;BR /&gt;informat adtc date9.;&lt;BR /&gt;format adtc yymmdd10.;&lt;BR /&gt;datalines;&lt;BR /&gt;100 15JAN2010&lt;BR /&gt;100 14AUG2010&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sort data= have1 out = have1_sort;&lt;BR /&gt;by usubjid;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Proc Sql;&lt;BR /&gt;Create Table want_sql as select a.usubjid, adtc , epoch,&lt;BR /&gt;count, sstdtc, sendtc From have1 as a left join have as b on a.usubjid= b.usubjid where&lt;BR /&gt;sstdtc &amp;lt;= adtc &amp;lt;=sendtc order by usubjid ,adtc,count;&lt;BR /&gt;Quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc print data = want_sql;&lt;BR /&gt;title'proc sql result';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/****proc transpose method******/&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;BR /&gt;create table _have as&lt;BR /&gt;select usubjid, epoch , sstdtc as start, sendtc as end ,count from have&lt;BR /&gt;order by usubjid, epoch,count;&lt;BR /&gt;quit;&lt;BR /&gt;proc sort data = _have out= have_s;&lt;BR /&gt;by usubjid count;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc transpose data=have_s out=s_t;&lt;BR /&gt;by usubjid count;&lt;BR /&gt;var epoch start end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc transpose data=s_t out=set_f(drop=_name_) delimiter=_;&lt;BR /&gt;by usubjid;&lt;BR /&gt;id _name_ count;&lt;BR /&gt;var col1;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data se_f;&lt;BR /&gt;merge s_t (in=ina) set_f (in=inb);&lt;BR /&gt;by usubjid;&lt;BR /&gt;drop col1;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sort data = se_f ;&lt;BR /&gt;by usubjid ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data want;&lt;BR /&gt;merge have1 (in=ina) se_f(in=inf);&lt;BR /&gt;by usubjid;&lt;/P&gt;&lt;P&gt;if ina;&lt;BR /&gt;array sstdtc(3) start_1-start_3;&lt;BR /&gt;array sendtc(3) end_1-end_3;&lt;BR /&gt;array ep(3) epoch_1-epoch_3;&lt;/P&gt;&lt;P&gt;do i=1 to 3;&lt;BR /&gt;sestd=strip(sstdtc(i));&lt;BR /&gt;seend=strip(sendtc(i));&lt;BR /&gt;put adtc;&lt;/P&gt;&lt;P&gt;aestd=put(adtc,yymmdd10.);&lt;BR /&gt;format aestd yymmdd10.;&lt;BR /&gt;put sestd;&lt;BR /&gt;put aestd;&lt;BR /&gt;put seend;&lt;BR /&gt;put ep(i);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if sestd &amp;lt;= aestd &amp;lt;= seend then&lt;BR /&gt;do;&lt;BR /&gt;epoch = ep(i);&lt;BR /&gt;leave;&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;drop _name_ epoch_1 epoch_2 epoch_3 start_1 start_2 start_3 end_1 end_2 end_3 aestd i;&lt;BR /&gt;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data want_transpose;&lt;BR /&gt;set want;&lt;BR /&gt;rename sestd=sstdtc&lt;BR /&gt;seend = sendtc;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sort data =want_transpose nodupkey ;&lt;BR /&gt;by usubjid count;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc print data=want_transpose;&lt;BR /&gt;title 'proc transpose result';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc compare base = want_sql compare= want_transpose;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 17:56:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Compare-Result-between-Proc-SQL-and-Proc-Transpose-not/m-p/771192#M244682</guid>
      <dc:creator>ng1090</dc:creator>
      <dc:date>2021-09-29T17:56:20Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Compare Result-between Proc SQL and Proc Transpose not matching, getting different results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Compare-Result-between-Proc-SQL-and-Proc-Transpose-not/m-p/771750#M244961</link>
      <description>&lt;P&gt;Hello&lt;BR /&gt;&amp;nbsp;What are you trying to achieve?&lt;/P&gt;
&lt;P&gt;The first appears to be comprehensible but not your second series steps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Oct 2021 12:31:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Compare-Result-between-Proc-SQL-and-Proc-Transpose-not/m-p/771750#M244961</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2021-10-02T12:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Compare Result-between Proc SQL and Proc Transpose not matching, getting different results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Compare-Result-between-Proc-SQL-and-Proc-Transpose-not/m-p/771751#M244962</link>
      <description>Hi&lt;BR /&gt;I already got the solution thanks for your response. Yes, I made some&lt;BR /&gt;changes to the second step. That was dummy data I just wanted to check I&lt;BR /&gt;will get the same result with both methods (proc SQL and proc transpose )or&lt;BR /&gt;not.&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Sat, 02 Oct 2021 12:40:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Compare-Result-between-Proc-SQL-and-Proc-Transpose-not/m-p/771751#M244962</guid>
      <dc:creator>ng1090</dc:creator>
      <dc:date>2021-10-02T12:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Compare Result-between Proc SQL and Proc Transpose not matching, getting different results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Compare-Result-between-Proc-SQL-and-Proc-Transpose-not/m-p/771754#M244963</link>
      <description>Great.&lt;BR /&gt;If you can share your observation on the forum that may help others.&lt;BR /&gt;</description>
      <pubDate>Sat, 02 Oct 2021 12:56:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Compare-Result-between-Proc-SQL-and-Proc-Transpose-not/m-p/771754#M244963</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2021-10-02T12:56:04Z</dc:date>
    </item>
  </channel>
</rss>

