<?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: Conflicting Formats/Values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Conflicting-Formats-Values/m-p/325500#M72393</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;Actually that did get rid of the leading zeros, nice. I realized I accidentally dropped the temporary variable instead.&lt;/P&gt;</description>
    <pubDate>Tue, 17 Jan 2017 22:07:41 GMT</pubDate>
    <dc:creator>JediApprentice</dc:creator>
    <dc:date>2017-01-17T22:07:41Z</dc:date>
    <item>
      <title>Conflicting Formats/Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conflicting-Formats-Values/m-p/325488#M72388</link>
      <description>&lt;P&gt;I have a two datasets that I'm trying to join that have three variables that either have conflicting formats or values or both:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dataset One&amp;nbsp;&lt;/P&gt;&lt;P&gt;FILL_DT: DATETIME18. (values look like 11JAN17:03:00:00)&lt;/P&gt;&lt;P&gt;RX_NBR: 12. (values look like 1038484)&lt;/P&gt;&lt;P&gt;NCPDP_ID: 15. (values look like 4542646)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dataset Two&lt;/P&gt;&lt;P&gt;FILL_DT: MMDDYY10. (values look like 01/10/2017)&lt;/P&gt;&lt;P&gt;RX_NBR: $12. (values look like 000008829507) - notice this has leading zeros where as in the other dataset it doesnt, I want to get rid of these leading zeros. They don't all have the same number of leading zeros either.&lt;/P&gt;&lt;P&gt;NCPDP_ID: $15. (values look like 1482152)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So what I'd like is:&lt;/P&gt;&lt;P&gt;FILL_DT needs to be MMDDYY10. format in both datasets&lt;/P&gt;&lt;P&gt;RX_NBR needs to be 12. format in both datasets AND I need to get rid of leading zeros (from values from dataset 2)&lt;/P&gt;&lt;P&gt;NCPDP needs to be 15. in both datasets&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried using input and put but keep running into different errors like when I tried to convert from DATETIME to MMDDYY10. I get the message "Date value out of range". When I try to use input to convert from $15. to 15. the format becomes blank when I do a proc contents and when I try and join it tells me its of a different type.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 21:37:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conflicting-Formats-Values/m-p/325488#M72388</guid>
      <dc:creator>JediApprentice</dc:creator>
      <dc:date>2017-01-17T21:37:57Z</dc:date>
    </item>
    <item>
      <title>Re: Conflicting Formats/Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conflicting-Formats-Values/m-p/325492#M72389</link>
      <description>&lt;P&gt;For fill_dt do the following:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;format fill_dt mmddyy10.;
fill_dt = datepart(fill_dt);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For the variables in the second dataset, do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;format intval 12.;
intval = input(rx_nbr,12.);
drop rx_nbr;
rename intval=rx_nbr;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Creation of a new variable has to be done because you can't change the type of an existing variable.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 21:44:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conflicting-Formats-Values/m-p/325492#M72389</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-01-17T21:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: Conflicting Formats/Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conflicting-Formats-Values/m-p/325497#M72391</link>
      <description>&lt;P&gt;I see. Looks like that works. The only problem I have now is that RX_NBR in dataset 1 has values like 777955 but in dataset 2 is 000000777955. It's not always the case that there are 6 leading zeros also. Sometimes its just 5...They always have the same length but there coul be a value like 000007795555&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 21:57:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conflicting-Formats-Values/m-p/325497#M72391</guid>
      <dc:creator>JediApprentice</dc:creator>
      <dc:date>2017-01-17T21:57:12Z</dc:date>
    </item>
    <item>
      <title>Re: Conflicting Formats/Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conflicting-Formats-Values/m-p/325498#M72392</link>
      <description>&lt;P&gt;Is it a fixed length, ie always 12 chars? Is it char or numeric?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The numeric format fo add leading zeros is ZW - would be Z10. where the assumption is the number is 10 digits long.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 21:58:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conflicting-Formats-Values/m-p/325498#M72392</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-01-17T21:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: Conflicting Formats/Values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Conflicting-Formats-Values/m-p/325500#M72393</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;Actually that did get rid of the leading zeros, nice. I realized I accidentally dropped the temporary variable instead.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2017 22:07:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Conflicting-Formats-Values/m-p/325500#M72393</guid>
      <dc:creator>JediApprentice</dc:creator>
      <dc:date>2017-01-17T22:07:41Z</dc:date>
    </item>
  </channel>
</rss>

