<?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: Concise Data Set in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Concise-Data-Set/m-p/9247#M443</link>
    <description>OK.&lt;BR /&gt;
Easy.&lt;BR /&gt;
[pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data  temp;&lt;BR /&gt;
infile datalines dlm=' ,';&lt;BR /&gt;
input Quarter Prod1 Prod2 Prod3 ;&lt;BR /&gt;
datalines;&lt;BR /&gt;
1, 685.35, ., .,&lt;BR /&gt;
2, 2925.55, ., .,&lt;BR /&gt;
3, 469553.6, ., .,&lt;BR /&gt;
4, 1099.85, ., .,&lt;BR /&gt;
1, ., 10220.51, .,&lt;BR /&gt;
1, ., ., 1510.16,&lt;BR /&gt;
2, ., ., 612346.89,&lt;BR /&gt;
3, ., ., 158393.23,&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
proc sort data=temp;&lt;BR /&gt;
 by quarter;&lt;BR /&gt;
run;&lt;BR /&gt;
data want(drop=prod:);&lt;BR /&gt;
 set temp;&lt;BR /&gt;
 retain _prod1 _prod2 _prod3;&lt;BR /&gt;
 by quarter;&lt;BR /&gt;
 if first.quarter then call missing(of _prod1 _prod2 _prod3);&lt;BR /&gt;
 _prod1=coalesce(_prod1,prod1);&lt;BR /&gt;
 _prod2=coalesce(_prod2,prod2);&lt;BR /&gt;
 _prod3=coalesce(_prod3,prod3);&lt;BR /&gt;
 if last.quarter then output;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
    <pubDate>Wed, 08 Jun 2011 09:47:23 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2011-06-08T09:47:23Z</dc:date>
    <item>
      <title>Concise Data Set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concise-Data-Set/m-p/9246#M442</link>
      <description>After doing a PROC TRANSPOSE, I got this data. &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Quarter	Prod1	Prod2	Prod3&lt;BR /&gt;
1,	685.35,	.,	.,&lt;BR /&gt;
2,	2925.55,	.,	.,&lt;BR /&gt;
3,	469553.6,	.,	.,&lt;BR /&gt;
4,	1099.85,	.,	.,&lt;BR /&gt;
1,	.,	10220.51,	.,&lt;BR /&gt;
1,	.,	.,	1510.16,&lt;BR /&gt;
2,	.,	.,	612346.89,&lt;BR /&gt;
3,	.,	.,	158393.23,&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I wish to put them togethet in such manner that quarter does not repeate.&lt;BR /&gt;
&lt;BR /&gt;
Quarter	Prod1	Prod2	Prod3&lt;BR /&gt;
1,	685.35,	10220.51,	1510.16,&lt;BR /&gt;
2,	2925.55,	.,	612346.89,&lt;BR /&gt;
3,	469553.6,	.,	158393.23,&lt;BR /&gt;
4,	1099.85,	.,	.&lt;BR /&gt;
&lt;BR /&gt;
What is an efficient way of approaching this problem?&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Jijil Ramakrishnan</description>
      <pubDate>Wed, 08 Jun 2011 09:16:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concise-Data-Set/m-p/9246#M442</guid>
      <dc:creator>JAR</dc:creator>
      <dc:date>2011-06-08T09:16:00Z</dc:date>
    </item>
    <item>
      <title>Re: Concise Data Set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concise-Data-Set/m-p/9247#M443</link>
      <description>OK.&lt;BR /&gt;
Easy.&lt;BR /&gt;
[pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data  temp;&lt;BR /&gt;
infile datalines dlm=' ,';&lt;BR /&gt;
input Quarter Prod1 Prod2 Prod3 ;&lt;BR /&gt;
datalines;&lt;BR /&gt;
1, 685.35, ., .,&lt;BR /&gt;
2, 2925.55, ., .,&lt;BR /&gt;
3, 469553.6, ., .,&lt;BR /&gt;
4, 1099.85, ., .,&lt;BR /&gt;
1, ., 10220.51, .,&lt;BR /&gt;
1, ., ., 1510.16,&lt;BR /&gt;
2, ., ., 612346.89,&lt;BR /&gt;
3, ., ., 158393.23,&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
proc sort data=temp;&lt;BR /&gt;
 by quarter;&lt;BR /&gt;
run;&lt;BR /&gt;
data want(drop=prod:);&lt;BR /&gt;
 set temp;&lt;BR /&gt;
 retain _prod1 _prod2 _prod3;&lt;BR /&gt;
 by quarter;&lt;BR /&gt;
 if first.quarter then call missing(of _prod1 _prod2 _prod3);&lt;BR /&gt;
 _prod1=coalesce(_prod1,prod1);&lt;BR /&gt;
 _prod2=coalesce(_prod2,prod2);&lt;BR /&gt;
 _prod3=coalesce(_prod3,prod3);&lt;BR /&gt;
 if last.quarter then output;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Wed, 08 Jun 2011 09:47:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concise-Data-Set/m-p/9247#M443</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-06-08T09:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: Concise Data Set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concise-Data-Set/m-p/9248#M444</link>
      <description>The UPDATE statement is appropriate to this problem.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data have;&lt;BR /&gt;
   infile cards dsd;&lt;BR /&gt;
   input Quarter Prod1-Prod3;&lt;BR /&gt;
   cards;&lt;BR /&gt;
1,685.35,.,.,&lt;BR /&gt;
2,2925.55,.,.,&lt;BR /&gt;
3,469553.6,.,.,&lt;BR /&gt;
4,1099.85,.,.,&lt;BR /&gt;
1,.,10220.51,.,&lt;BR /&gt;
1,.,.,1510.16,&lt;BR /&gt;
2,.,.,612346.89,&lt;BR /&gt;
3,.,.,158393.23,&lt;BR /&gt;
;;;;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc sort data=have;&lt;BR /&gt;
   by quarter;&lt;BR /&gt;
   run;&lt;BR /&gt;
data need;&lt;BR /&gt;
   update have(obs=0) have;&lt;BR /&gt;
   by quarter;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc print;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Wed, 08 Jun 2011 11:12:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concise-Data-Set/m-p/9248#M444</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2011-06-08T11:12:39Z</dc:date>
    </item>
    <item>
      <title>Re: Concise Data Set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concise-Data-Set/m-p/9249#M445</link>
      <description>You might be able to solve this on the TRANSPOSE side.  My guess would be that you did not use the ID statement.  the transpose would look something like:&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc transpose data=old out=new;&lt;BR /&gt;
by quarter;&lt;BR /&gt;
id prod;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Wed, 08 Jun 2011 18:20:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concise-Data-Set/m-p/9249#M445</guid>
      <dc:creator>ArtC</dc:creator>
      <dc:date>2011-06-08T18:20:31Z</dc:date>
    </item>
    <item>
      <title>Re: Concise Data Set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concise-Data-Set/m-p/9250#M446</link>
      <description>Your code is great.I must missed something in docutmentation.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Thu, 09 Jun 2011 02:07:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concise-Data-Set/m-p/9250#M446</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-06-09T02:07:05Z</dc:date>
    </item>
    <item>
      <title>Re: Concise Data Set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concise-Data-Set/m-p/9251#M447</link>
      <description>Awesome!!&lt;BR /&gt;
Thanks a million!</description>
      <pubDate>Thu, 09 Jun 2011 05:05:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concise-Data-Set/m-p/9251#M447</guid>
      <dc:creator>JAR</dc:creator>
      <dc:date>2011-06-09T05:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: Concise Data Set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concise-Data-Set/m-p/9252#M448</link>
      <description>Hi.&lt;BR /&gt;
Do you try the _null_'s code?&lt;BR /&gt;
I think he is more clever tham me. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Thu, 09 Jun 2011 06:19:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concise-Data-Set/m-p/9252#M448</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-06-09T06:19:13Z</dc:date>
    </item>
  </channel>
</rss>

