<?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 Creating a combined value of variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-combined-value-of-variables/m-p/396742#M95820</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA child_birthday;
input subject name $ year  month  date ;
datalines;
1001 Thomas 2000 12 15
;
run; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I want to create a new variables named as birthday_yyyymmdd from the variables year, month, and date.&lt;/P&gt;&lt;P&gt;For example, from the dateset, l want to create a variable 2001215.&lt;/P&gt;&lt;P&gt;I have tried&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data child_birthday;
birthday_yymmdd=substr(year,1,4)+substr(month,1,2)+substr(date,1,2);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;but I am not getting anything.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help or comment would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maria.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 18 Sep 2017 07:55:11 GMT</pubDate>
    <dc:creator>sasworker16</dc:creator>
    <dc:date>2017-09-18T07:55:11Z</dc:date>
    <item>
      <title>Creating a combined value of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-combined-value-of-variables/m-p/396742#M95820</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA child_birthday;
input subject name $ year  month  date ;
datalines;
1001 Thomas 2000 12 15
;
run; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I want to create a new variables named as birthday_yyyymmdd from the variables year, month, and date.&lt;/P&gt;&lt;P&gt;For example, from the dateset, l want to create a variable 2001215.&lt;/P&gt;&lt;P&gt;I have tried&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data child_birthday;
birthday_yymmdd=substr(year,1,4)+substr(month,1,2)+substr(date,1,2);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;but I am not getting anything.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help or comment would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maria.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2017 07:55:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-combined-value-of-variables/m-p/396742#M95820</guid>
      <dc:creator>sasworker16</dc:creator>
      <dc:date>2017-09-18T07:55:11Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a combined value of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-combined-value-of-variables/m-p/396743#M95821</link>
      <description>&lt;P&gt;The reason it's not working is that you've created year, month and date as numeric whereas substr only works on character variables. If you want to create a date from individual numeric values use the mdy function like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
	format birthday_yymmdd date9.;
	set child_birthday;
	birthday_yymmdd=mdy(month,date,year);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Sep 2017 08:04:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-combined-value-of-variables/m-p/396743#M95821</guid>
      <dc:creator>ChrisBrooks</dc:creator>
      <dc:date>2017-09-18T08:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a combined value of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-combined-value-of-variables/m-p/396753#M95822</link>
      <description>&lt;P&gt;Not sure if this is what you want to do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try this....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WANT;
  set HAVE;
call symput=("DT_SUFFIX",cats("BIRTHDAY_",YEAR,MONTH,DATE));
BIRTHDAY_=MDY(MONTH,DATE,YEAR);
format birthday_ date9.;
run;


proc datasets lib=work;
  modify want;
  rename birthday_=&amp;amp;dt_suffix.;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2017 09:18:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-combined-value-of-variables/m-p/396753#M95822</guid>
      <dc:creator>ShiroAmada</dc:creator>
      <dc:date>2017-09-18T09:18:48Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a combined value of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-combined-value-of-variables/m-p/397337#M96023</link>
      <description>&lt;P&gt;data want;&lt;BR /&gt;set child_birthday;&lt;BR /&gt;format birthday_yymmdd yymmdd10.;&lt;BR /&gt;birthday_yymmdd =mdy(month,date,year);&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 06:42:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-combined-value-of-variables/m-p/397337#M96023</guid>
      <dc:creator>TarunKumar</dc:creator>
      <dc:date>2017-09-20T06:42:14Z</dc:date>
    </item>
  </channel>
</rss>

