<?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 to put a certain value to all values in a variable? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-certain-value-to-all-values-in-a-variable/m-p/449196#M283566</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset where people's birth years and months are recorded.&lt;/P&gt;&lt;P&gt;I want to assume that each person was born on the first date of each month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g) Someone born in April of 1980-&amp;gt;April 1st, 1980&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one; 
input ID $ birth_ym;
cards;
1 198004 
2 199712 
3 200207
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I would want to create a variable that has '01' added to the end for each value of birth_ym&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;198004-&amp;gt;19800401&lt;/P&gt;&lt;P&gt;199712-&amp;gt;19971201&lt;/P&gt;&lt;P&gt;200207-&amp;gt;20020701&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, I would want a variable to include&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;birthday_new&lt;/P&gt;&lt;P&gt;19800401&lt;/P&gt;&lt;P&gt;19971201&lt;/P&gt;&lt;P&gt;20020701&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a simple way to solve this problem?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Wed, 28 Mar 2018 01:42:37 GMT</pubDate>
    <dc:creator>sasworker16</dc:creator>
    <dc:date>2018-03-28T01:42:37Z</dc:date>
    <item>
      <title>How to put a certain value to all values in a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-certain-value-to-all-values-in-a-variable/m-p/449196#M283566</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset where people's birth years and months are recorded.&lt;/P&gt;&lt;P&gt;I want to assume that each person was born on the first date of each month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g) Someone born in April of 1980-&amp;gt;April 1st, 1980&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one; 
input ID $ birth_ym;
cards;
1 198004 
2 199712 
3 200207
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I would want to create a variable that has '01' added to the end for each value of birth_ym&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;198004-&amp;gt;19800401&lt;/P&gt;&lt;P&gt;199712-&amp;gt;19971201&lt;/P&gt;&lt;P&gt;200207-&amp;gt;20020701&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, I would want a variable to include&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;birthday_new&lt;/P&gt;&lt;P&gt;19800401&lt;/P&gt;&lt;P&gt;19971201&lt;/P&gt;&lt;P&gt;20020701&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a simple way to solve this problem?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 01:42:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-certain-value-to-all-values-in-a-variable/m-p/449196#M283566</guid>
      <dc:creator>sasworker16</dc:creator>
      <dc:date>2018-03-28T01:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to put a certain value to all values in a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-certain-value-to-all-values-in-a-variable/m-p/449199#M283567</link>
      <description>&lt;P&gt;Do you mean you are looking for&amp;nbsp;&lt;/P&gt;&lt;TABLE cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;YYMMN&lt;SPAN class="emph"&gt;w&lt;/SPAN&gt;. Informat&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN class="shortDesc"&gt;Reads date values in the form&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="emph"&gt;yyyymm&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;or&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="emph"&gt;yymm&lt;/SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one; 
input ID $ birth_ym : yymmn6.;
format 	birth_ym date9.;
cards;
1 198004 
2 199712 
3 200207
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Mar 2018 02:07:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-certain-value-to-all-values-in-a-variable/m-p/449199#M283567</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-03-28T02:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to put a certain value to all values in a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-certain-value-to-all-values-in-a-variable/m-p/449200#M283568</link>
      <description>&lt;P&gt;Can you read the existing month/year date value as a character string? If so, then this will work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data one (keep=ID birthday_new);&lt;BR /&gt;length ID $7 birth_ym $6;&lt;BR /&gt;input ID $ birth_ym $;&lt;BR /&gt;birthday_new = input( birth_ym || '01',&amp;nbsp; yymmdd8.);&lt;BR /&gt;format birthday_new date10.;&lt;BR /&gt;cards;&lt;BR /&gt;1 198004&lt;BR /&gt;2 199712&lt;BR /&gt;3 200207&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 02:29:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-certain-value-to-all-values-in-a-variable/m-p/449200#M283568</guid>
      <dc:creator>msjpnw</dc:creator>
      <dc:date>2018-03-28T02:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to put a certain value to all values in a variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-certain-value-to-all-values-in-a-variable/m-p/449252#M283569</link>
      <description>&lt;P&gt;You should study how SAS stores dates.&amp;nbsp; Dates are much more useful when stored in the form that SAS expects.&amp;nbsp; These are numeric variables, not dates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That being said, converting y our numbers to different numbers is relatively straightforward:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;birthdate = birth_ym * 100 + 1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you wanted to convert these values to the form that SAS expects, you could add after this equation:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;birthdate = input(put(birthdate, z8.), yymmd8.);&lt;/P&gt;
&lt;P&gt;format birthdate yymmdd10.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But dates in the "correct" form may not be useful to&amp;nbsp; you until you understand what they contain.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 09:48:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-put-a-certain-value-to-all-values-in-a-variable/m-p/449252#M283569</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-03-28T09:48:16Z</dc:date>
    </item>
  </channel>
</rss>

