<?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: How to copy the first cell to the next cells in one column? in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-copy-the-first-cell-to-the-next-cells-in-one-column/m-p/348045#M22981</link>
    <description>&lt;P&gt;Two things would help. &amp;nbsp;What does the log look like when you run the program? &amp;nbsp;And what does PROC CONTENTS show about the variables in the data set?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's possible that a very simple fix is in order. &amp;nbsp;Perhaps Program_name should be replaced by 'Program Name'n&amp;nbsp;if that is the actual name of the variable in your data. &amp;nbsp;Post the evidence one way or the other.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Apr 2017 11:14:55 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2017-04-07T11:14:55Z</dc:date>
    <item>
      <title>How to copy the first cell to the next cells in one column?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-copy-the-first-cell-to-the-next-cells-in-one-column/m-p/344004#M22769</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I've just begin learning Enterprise Guide for a month.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I encountered the problem below.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In the picture, the data is continuous, but in the &lt;STRONG&gt;Program Name&lt;/STRONG&gt; column, the yellow cells are useless. Therefore,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;I'd copy the first &lt;STRONG&gt;program name&lt;/STRONG&gt; to the next cells in same column until next "PRO" in Column of "&lt;STRONG&gt;Cycle&lt;/STRONG&gt;",&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;and do the same action continually.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'd count the &lt;STRONG&gt;Error code&lt;/STRONG&gt; for each program, example...."&lt;/SPAN&gt;&lt;SPAN&gt;Program X has 2 shift, 2 open and 1 limited".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Does it has any code or method to slove this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The only way I think is "do loop", I even don't know it is correct or not. It's really difficult for me....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/7935iD923814B34737019/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="Problem.png" title="Problem.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2017 09:59:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-copy-the-first-cell-to-the-next-cells-in-one-column/m-p/344004#M22769</guid>
      <dc:creator>tylin0117</dc:creator>
      <dc:date>2017-03-24T09:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to copy the first cell to the next cells in one column?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-copy-the-first-cell-to-the-next-cells-in-one-column/m-p/344033#M22772</link>
      <description>&lt;P&gt;Here's some code that will do what you are asking for. &amp;nbsp;However, the order of the columns will change:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;if cycle='PRO' then New_Program_Name = Program_Name;&lt;/P&gt;
&lt;P&gt;retain New_Program_Name;&lt;/P&gt;
&lt;P&gt;drop Program_Name;&lt;/P&gt;
&lt;P&gt;rename New_Program_Name = Program_Name;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the order of the columns is important, you can preserve that. &amp;nbsp;The way you would learn the most: &amp;nbsp;find the length of Program_Name. &amp;nbsp;Then insert between the DATA and SET statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;length Date Time 8 Cycle $ 6 Program_Name New_Program_Name $ 6;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Those numbers are just examples ... you have to use whatever is in your data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can automate the process instead, but it will look a little complex. &amp;nbsp;Insert between the DATA and SET statements:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if 5=4 then do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;set have (keep=date time cycle program_name);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;New_Program_Name = program_name;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2017 11:35:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-copy-the-first-cell-to-the-next-cells-in-one-column/m-p/344033#M22772</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-03-24T11:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to copy the first cell to the next cells in one column?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-copy-the-first-cell-to-the-next-cells-in-one-column/m-p/348025#M22980</link>
      <description>&lt;P&gt;Thank you for your respond.&lt;/P&gt;&lt;P&gt;Sorry for late reply. I have discussed with my friend for two weeks. We still cannot solve this problem.&lt;/P&gt;&lt;P&gt;I follow your suggestion and put the code into the project.&lt;/P&gt;&lt;P&gt;We encountered the problem below. The column of "Program_Name" all disappeared.&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/8198i3F9DA63C07330521/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="Problem.PNG" title="Problem.PNG" width="251" height="126" /&gt;&lt;/P&gt;&lt;P&gt;Could you please help to see where the problem is?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I attached the excel file and the code below. Thank you very much again.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;

if 5=4 then do;

   set WORK.'RAW DATA'n (keep=date time cycle program_name);

   New_Program_Name = program_name;

end;

set WORK.'RAW DATA'n;

if cycle="PRO" then New_Program_Name = Program_Name;

retain New_Program_Name;

drop Program_Name;

rename New_Program_Name = Program_Name;

run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2017 08:57:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-copy-the-first-cell-to-the-next-cells-in-one-column/m-p/348025#M22980</guid>
      <dc:creator>tylin0117</dc:creator>
      <dc:date>2017-04-07T08:57:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to copy the first cell to the next cells in one column?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-copy-the-first-cell-to-the-next-cells-in-one-column/m-p/348045#M22981</link>
      <description>&lt;P&gt;Two things would help. &amp;nbsp;What does the log look like when you run the program? &amp;nbsp;And what does PROC CONTENTS show about the variables in the data set?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's possible that a very simple fix is in order. &amp;nbsp;Perhaps Program_name should be replaced by 'Program Name'n&amp;nbsp;if that is the actual name of the variable in your data. &amp;nbsp;Post the evidence one way or the other.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Apr 2017 11:14:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-copy-the-first-cell-to-the-next-cells-in-one-column/m-p/348045#M22981</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-04-07T11:14:55Z</dc:date>
    </item>
  </channel>
</rss>

