<?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: Splitting variables based on variable values in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Splitting-variables-based-on-variable-values/m-p/511953#M15902</link>
    <description>&lt;P&gt;Here is one way to do that&lt;/P&gt;
&lt;PRE&gt;data have;&lt;BR /&gt;infile cards;&lt;BR /&gt;input Information $;&lt;BR /&gt;output;&lt;BR /&gt;input Date;&lt;BR /&gt;information = .;&lt;BR /&gt;output;&lt;BR /&gt;cards;&lt;BR /&gt;X1&lt;BR /&gt;120225&lt;BR /&gt;G8&lt;BR /&gt;180619&lt;BR /&gt;;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 10 Nov 2018 18:44:36 GMT</pubDate>
    <dc:creator>VDD</dc:creator>
    <dc:date>2018-11-10T18:44:36Z</dc:date>
    <item>
      <title>Splitting variables based on variable values</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Splitting-variables-based-on-variable-values/m-p/511948#M15899</link>
      <description>&lt;P&gt;I have a character variable 'Information' with the following&amp;nbsp;values:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Information&lt;/P&gt;&lt;P&gt;X1&lt;/P&gt;&lt;P&gt;120225&lt;/P&gt;&lt;P&gt;G8&lt;/P&gt;&lt;P&gt;180619&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Based on Information variable, I want to create two variables as follows:&lt;/P&gt;&lt;P&gt;Information&amp;nbsp; &amp;nbsp; Date&lt;/P&gt;&lt;P&gt;X1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&lt;/P&gt;&lt;P&gt;.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;120225&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;G8&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;/P&gt;&lt;P&gt;.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;180619&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Nov 2018 18:31:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Splitting-variables-based-on-variable-values/m-p/511948#M15899</guid>
      <dc:creator>pmpradhan</dc:creator>
      <dc:date>2018-11-10T18:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting variables based on variable values</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Splitting-variables-based-on-variable-values/m-p/511949#M15900</link>
      <description>&lt;P&gt;are you sure that you want the null values as the sample want has?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or do you want this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards;
input Information $  Date;
cards;
X1
120225
G8
180619
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 10 Nov 2018 18:35:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Splitting-variables-based-on-variable-values/m-p/511949#M15900</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2018-11-10T18:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting variables based on variable values</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Splitting-variables-based-on-variable-values/m-p/511951#M15901</link>
      <description>Yes I want them as the null values as the sample want has.</description>
      <pubDate>Sat, 10 Nov 2018 18:38:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Splitting-variables-based-on-variable-values/m-p/511951#M15901</guid>
      <dc:creator>pmpradhan</dc:creator>
      <dc:date>2018-11-10T18:38:23Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting variables based on variable values</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Splitting-variables-based-on-variable-values/m-p/511953#M15902</link>
      <description>&lt;P&gt;Here is one way to do that&lt;/P&gt;
&lt;PRE&gt;data have;&lt;BR /&gt;infile cards;&lt;BR /&gt;input Information $;&lt;BR /&gt;output;&lt;BR /&gt;input Date;&lt;BR /&gt;information = .;&lt;BR /&gt;output;&lt;BR /&gt;cards;&lt;BR /&gt;X1&lt;BR /&gt;120225&lt;BR /&gt;G8&lt;BR /&gt;180619&lt;BR /&gt;;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Nov 2018 18:44:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Splitting-variables-based-on-variable-values/m-p/511953#M15902</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2018-11-10T18:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting variables based on variable values</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Splitting-variables-based-on-variable-values/m-p/511956#M15903</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards;
if mod(_n_,2) ne 0 then input Information $;
else input date;
cards;
X1
120225
G8
180619
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 10 Nov 2018 18:45:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Splitting-variables-based-on-variable-values/m-p/511956#M15903</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-11-10T18:45:24Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting variables based on variable values</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Splitting-variables-based-on-variable-values/m-p/511960#M15904</link>
      <description>&lt;P&gt;Information is one of the many variables in my SAS dataset. The observations are more than couple hundreds. Is there something better than infile&amp;nbsp;statement? where I don't have to enter the variable values?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Nov 2018 18:52:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Splitting-variables-based-on-variable-values/m-p/511960#M15904</guid>
      <dc:creator>pmpradhan</dc:creator>
      <dc:date>2018-11-10T18:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting variables based on variable values</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Splitting-variables-based-on-variable-values/m-p/511961#M15905</link>
      <description>&lt;P&gt;a larger sample representing what you have with more of the variables you are speaking about now.&amp;nbsp; also at what point do the null values get reset based on your want sample that is unclear now since you say there are many variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please don't play the part of a manager if your trying to learn to code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this link may assist you&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/New-SAS-User/Good-SAS-Course-in-Coursera/m-p/507864#M1531" target="_blank"&gt;https://communities.sas.com/t5/New-SAS-User/Good-SAS-Course-in-Coursera/m-p/507864#M1531&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;the course if free in audit.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Nov 2018 19:07:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Splitting-variables-based-on-variable-values/m-p/511961#M15905</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2018-11-10T19:07:26Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting variables based on variable values</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Splitting-variables-based-on-variable-values/m-p/511962#M15906</link>
      <description>&lt;P&gt;I need a better and comprehensive sample to code and test rather than imagining what could be the likely&lt;/P&gt;</description>
      <pubDate>Sat, 10 Nov 2018 19:03:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Splitting-variables-based-on-variable-values/m-p/511962#M15906</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-11-10T19:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting variables based on variable values</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Splitting-variables-based-on-variable-values/m-p/511966#M15907</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/105450"&gt;@pmpradhan&lt;/a&gt;&amp;nbsp; try this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Information $;
cards;
X1
120225
G8
180619
;

data want;
set have;
if anyalpha(information)=0 then date=input(information,yymmdd8.);
if date then call missing(information);
format date yymmdd8.;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;My assumptions:&lt;/P&gt;
&lt;P&gt;Your source is a sas dataset&lt;/P&gt;
&lt;P&gt;Date values are all numbers&lt;/P&gt;
&lt;P&gt;Information value may be a mix of numbers/other chars&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 10 Nov 2018 19:49:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Splitting-variables-based-on-variable-values/m-p/511966#M15907</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-11-10T19:49:19Z</dc:date>
    </item>
  </channel>
</rss>

