<?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: Short question about filling down column with a data value in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Short-question-about-filling-down-column-with-a-data-value/m-p/838699#M36255</link>
    <description>Hello svh, thank you so much for your quick answer. It was so helpful!! I have an extra question, in future I may have many more variables in 'have', so in your code for the line I will have so many extra 'a.something':&lt;BR /&gt;&lt;BR /&gt;select a.id, min(a.a) as a, a.b, a.c, a.d, a.e, a.f, ...so many more a.variable&lt;BR /&gt;&lt;BR /&gt;Is there any way or syntax to suppress ALL available variables, something like a.all ?? Thanks again!</description>
    <pubDate>Fri, 14 Oct 2022 19:05:31 GMT</pubDate>
    <dc:creator>hellorc</dc:creator>
    <dc:date>2022-10-14T19:05:31Z</dc:date>
    <item>
      <title>Short question about filling down column with a data value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Short-question-about-filling-down-column-with-a-data-value/m-p/838691#M36253</link>
      <description>&lt;P&gt;Closed&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2022 19:18:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Short-question-about-filling-down-column-with-a-data-value/m-p/838691#M36253</guid>
      <dc:creator>hellorc</dc:creator>
      <dc:date>2022-10-14T19:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: Short question about filling down column with a data value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Short-question-about-filling-down-column-with-a-data-value/m-p/838693#M36254</link>
      <description>&lt;P&gt;This kind of transformation is ideally suited for PROC SQL with a GROUP BY statement, which allows you to derive group-level variables that can be added to your data set.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc sql;
   create table have2 as
   select a.id, min(a.a) as a, a.b, a.c
   from have a 
   group by a.id;
   quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Oct 2022 18:40:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Short-question-about-filling-down-column-with-a-data-value/m-p/838693#M36254</guid>
      <dc:creator>svh</dc:creator>
      <dc:date>2022-10-14T18:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: Short question about filling down column with a data value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Short-question-about-filling-down-column-with-a-data-value/m-p/838699#M36255</link>
      <description>Hello svh, thank you so much for your quick answer. It was so helpful!! I have an extra question, in future I may have many more variables in 'have', so in your code for the line I will have so many extra 'a.something':&lt;BR /&gt;&lt;BR /&gt;select a.id, min(a.a) as a, a.b, a.c, a.d, a.e, a.f, ...so many more a.variable&lt;BR /&gt;&lt;BR /&gt;Is there any way or syntax to suppress ALL available variables, something like a.all ?? Thanks again!</description>
      <pubDate>Fri, 14 Oct 2022 19:05:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Short-question-about-filling-down-column-with-a-data-value/m-p/838699#M36255</guid>
      <dc:creator>hellorc</dc:creator>
      <dc:date>2022-10-14T19:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: Short question about filling down column with a data value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Short-question-about-filling-down-column-with-a-data-value/m-p/838701#M36256</link>
      <description>&lt;P&gt;A data step based solution, different sort as I don't think your sort does what you need.&lt;/P&gt;
&lt;PRE&gt;proc sort data=have;
   by id a;
run;

data want;
   set have;
   by id;
   retain tempa;
   if first.id then tempa=a;
   a=tempa;
   drop tempa;
run;&lt;/PRE&gt;
&lt;P&gt;By group processing for ID, which is your rule, First.Id to set a value of a Retained variable that keeps the first value of A and overwrites all the A, then dropped.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Caution: You did not describe any rule for what to do if the "smallest" value of A is missing. Missing is smaller than anything. If you don't want the other values replaced with missing then you need to provide some more rules.&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/431043"&gt;@hellorc&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello SAS community, I have a dataset that looks like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input id a b c @@;
datalines;
1 8 5 2
1 1 3 7
1 9 8 4
1 2 6 4
2 2 5 9
2 5 3 7
2 5 7 9
3 6 4 3
3 2 5 7
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For each id, I would like to sort by a variable, say 'a', from smallest to largest with the code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=have;
by a;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then, for each id, I would like to fill every 'a' variable entries with ONLY the smallest data value, so what I want is:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
input id a b c @@;
datalines;
1 1 3 7
1 1 6 4
1 1 5 2
1 1 8 4
2 2 5 9
2 2 3 7
2 2 7 9
3 2 5 7
3 2 4 3
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Might someone please help me with such manipulation technique? Thank you ahead!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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>Fri, 14 Oct 2022 19:13:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Short-question-about-filling-down-column-with-a-data-value/m-p/838701#M36256</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-10-14T19:13:28Z</dc:date>
    </item>
  </channel>
</rss>

