<?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 How can I separate rows and substitute the value of variables in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/How-can-I-separate-rows-and-substitute-the-value-of-variables/m-p/327859#M17299</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am facing a problem of separating a single row into multiple rows. My original data is as following:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;student id | year_code&lt;/P&gt;&lt;P&gt;----------------------------&lt;/P&gt;&lt;P&gt;1111 | 1213&lt;/P&gt;&lt;P&gt;----------------------------&lt;/P&gt;&lt;P&gt;1111 | 1314&lt;/P&gt;&lt;P&gt;----------------------------&lt;/P&gt;&lt;P&gt;1112 | 1213&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;I want to change 1213 into 201280,201310 and 201350, i.e, change the first row 1111|1213 to&lt;/P&gt;&lt;P&gt;1111 |201280&lt;/P&gt;&lt;P&gt;-----------------&lt;/P&gt;&lt;P&gt;1111 |201310&lt;/P&gt;&lt;P&gt;-----------------&lt;/P&gt;&lt;P&gt;1111 |201350.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any code I can use to obtain the result I want?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
    <pubDate>Thu, 26 Jan 2017 21:29:32 GMT</pubDate>
    <dc:creator>jiznow</dc:creator>
    <dc:date>2017-01-26T21:29:32Z</dc:date>
    <item>
      <title>How can I separate rows and substitute the value of variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-can-I-separate-rows-and-substitute-the-value-of-variables/m-p/327859#M17299</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am facing a problem of separating a single row into multiple rows. My original data is as following:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;student id | year_code&lt;/P&gt;&lt;P&gt;----------------------------&lt;/P&gt;&lt;P&gt;1111 | 1213&lt;/P&gt;&lt;P&gt;----------------------------&lt;/P&gt;&lt;P&gt;1111 | 1314&lt;/P&gt;&lt;P&gt;----------------------------&lt;/P&gt;&lt;P&gt;1112 | 1213&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;I want to change 1213 into 201280,201310 and 201350, i.e, change the first row 1111|1213 to&lt;/P&gt;&lt;P&gt;1111 |201280&lt;/P&gt;&lt;P&gt;-----------------&lt;/P&gt;&lt;P&gt;1111 |201310&lt;/P&gt;&lt;P&gt;-----------------&lt;/P&gt;&lt;P&gt;1111 |201350.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any code I can use to obtain the result I want?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2017 21:29:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-can-I-separate-rows-and-substitute-the-value-of-variables/m-p/327859#M17299</guid>
      <dc:creator>jiznow</dc:creator>
      <dc:date>2017-01-26T21:29:32Z</dc:date>
    </item>
    <item>
      <title>Re: How can I separate rows and substitute the value of variables</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-can-I-separate-rows-and-substitute-the-value-of-variables/m-p/327866#M17300</link>
      <description>&lt;P&gt;Does anything get done to the year_code values of 1314 and or 1213 in the third row?&lt;/P&gt;
&lt;P&gt;From what you post it isn't even clear if you have any SAS data set, do you?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have a SAS data set and want to change &lt;STRONG&gt;only the first observation&lt;/STRONG&gt; something like;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; if _n_=1 then do;&amp;nbsp; /*&amp;lt;= this does the first row only*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; year_code=201280;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output; /* replace the value and then save to output*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; year_code=201310;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output; /* second value and then save to output*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; year_code=2013500;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output; /* third value and then save to output*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp; end; /* the block of statements for the first record*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp; else output; /* write other records unchanged*/&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is supposed to be some logic in how other values may be assigned you should state it.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2017 21:40:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-can-I-separate-rows-and-substitute-the-value-of-variables/m-p/327866#M17300</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-01-26T21:40:30Z</dc:date>
    </item>
  </channel>
</rss>

