<?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: From a long table with multiple missing to one row without missing in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/From-a-long-table-with-multiple-missing-to-one-row-without/m-p/688052#M208953</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/267481"&gt;@Dinurik&lt;/a&gt;&amp;nbsp; ,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;'s approach is neat. Hovvever,You need to create a junk BY variable in an intermediate step.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
    data have;
    input theta1 theta3 sigma11 sigma13;
    datalines;
        . . . .
        0.22 . . .
        . . . .
        . 0.29 . .
        . . . .
        . . 0.02 -0.02
        . . . .
    ;
    run;

	data _have;
	 set have;
	 retain t 99999;
	 run;

data want;
 update _have(obs=0) _have;
 by t;
 drop t;
run;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 23:21:52 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2020-09-30T23:21:52Z</dc:date>
    <item>
      <title>From a long table with multiple missing to one row without missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/From-a-long-table-with-multiple-missing-to-one-row-without/m-p/688010#M208929</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I apologize if this has been asked before, this question is tricky to formulate, let alone find an answer in the forum.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; data have;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; input theta1 theta3 sigma11 sigma13;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; datalines;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; . . . .&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.22 . . .&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; . . . .&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; . 0.29 . .&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; . . . .&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; . . 0.02 -0.02&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; . . . .&lt;BR /&gt;&amp;nbsp; &amp;nbsp; ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I need to get a table like this: all values in one row:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; data want;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; input theta1 theta3 sigma11 sigma13 ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; datalines;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.22 0.29 0.02 -0.02&lt;BR /&gt;&amp;nbsp; &amp;nbsp; ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am curious if this can be done in few steps. I would appreciate any help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 20:59:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/From-a-long-table-with-multiple-missing-to-one-row-without/m-p/688010#M208929</guid>
      <dc:creator>Dinurik</dc:creator>
      <dc:date>2020-09-30T20:59:49Z</dc:date>
    </item>
    <item>
      <title>Re: From a long table with multiple missing to one row without missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/From-a-long-table-with-multiple-missing-to-one-row-without/m-p/688031#M208940</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
update have(obs=0) have;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Usually you'd want a BY statement as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/267481"&gt;@Dinurik&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I apologize if this has been asked before, this question is tricky to formulate, let alone find an answer in the forum.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a table like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; data have;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; input theta1 theta3 sigma11 sigma13;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; datalines;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; . . . .&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.22 . . .&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; . . . .&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; . 0.29 . .&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; . . . .&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; . . 0.02 -0.02&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; . . . .&lt;BR /&gt;&amp;nbsp; &amp;nbsp; ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I need to get a table like this: all values in one row:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; data want;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; input theta1 theta3 sigma11 sigma13 ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; datalines;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.22 0.29 0.02 -0.02&lt;BR /&gt;&amp;nbsp; &amp;nbsp; ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am curious if this can be done in few steps. I would appreciate any help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 21:26:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/From-a-long-table-with-multiple-missing-to-one-row-without/m-p/688031#M208940</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-09-30T21:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: From a long table with multiple missing to one row without missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/From-a-long-table-with-multiple-missing-to-one-row-without/m-p/688033#M208941</link>
      <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;Thanks! SAS returned this error message:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;ERROR: UPDATE statement needs a BY statement.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 21:32:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/From-a-long-table-with-multiple-missing-to-one-row-without/m-p/688033#M208941</guid>
      <dc:creator>Dinurik</dc:creator>
      <dc:date>2020-09-30T21:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: From a long table with multiple missing to one row without missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/From-a-long-table-with-multiple-missing-to-one-row-without/m-p/688043#M208948</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/267481"&gt;@Dinurik&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I apologize if this has been asked before, this question is tricky to formulate, let alone find an answer in the forum.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a table like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; data have;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; input theta1 theta3 sigma11 sigma13;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; datalines;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; . . . .&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.22 . . .&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; . . . .&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; . 0.29 . .&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; . . . .&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; . . 0.02 -0.02&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; . . . .&lt;BR /&gt;&amp;nbsp; &amp;nbsp; ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I need to get a table like this: all values in one row:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; data want;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; input theta1 theta3 sigma11 sigma13 ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; datalines;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.22 0.29 0.02 -0.02&lt;BR /&gt;&amp;nbsp; &amp;nbsp; ;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am curious if this can be done in few steps. I would appreciate any help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This works for your specific example:&lt;/P&gt;
&lt;PRE&gt;proc summary data=have ;
   var  theta1 theta3 sigma11 sigma13;
   output out=want (drop=_:) max=;
run;&lt;/PRE&gt;
&lt;P&gt;However if you have any of the variables with more than one non-missing values then likely it won't yield what you want, and will only work for numeric values.&lt;/P&gt;
&lt;P&gt;If you have data with more than one value for any of your variables then you need to provide an example what the output for that should look like.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 22:18:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/From-a-long-table-with-multiple-missing-to-one-row-without/m-p/688043#M208948</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-09-30T22:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: From a long table with multiple missing to one row without missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/From-a-long-table-with-multiple-missing-to-one-row-without/m-p/688052#M208953</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/267481"&gt;@Dinurik&lt;/a&gt;&amp;nbsp; ,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;'s approach is neat. Hovvever,You need to create a junk BY variable in an intermediate step.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
    data have;
    input theta1 theta3 sigma11 sigma13;
    datalines;
        . . . .
        0.22 . . .
        . . . .
        . 0.29 . .
        . . . .
        . . 0.02 -0.02
        . . . .
    ;
    run;

	data _have;
	 set have;
	 retain t 99999;
	 run;

data want;
 update _have(obs=0) _have;
 by t;
 drop t;
run;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 23:21:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/From-a-long-table-with-multiple-missing-to-one-row-without/m-p/688052#M208953</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-09-30T23:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: From a long table with multiple missing to one row without missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/From-a-long-table-with-multiple-missing-to-one-row-without/m-p/688054#M208955</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;I created a junk id variable through id=_n_, and it didn't occur to me that id is not supposed to change for the update statement to work. Thank you so much for the explanations!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 23:35:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/From-a-long-table-with-multiple-missing-to-one-row-without/m-p/688054#M208955</guid>
      <dc:creator>Dinurik</dc:creator>
      <dc:date>2020-09-30T23:35:50Z</dc:date>
    </item>
  </channel>
</rss>

