<?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: How to format character variable from excel data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-format-character-variable-from-excel-data/m-p/398952#M96571</link>
    <description>&lt;P&gt;data workingdata;&lt;BR /&gt;267 Set work.test;&lt;BR /&gt;268 COMPANY_FKEY=CIK;&lt;BR /&gt;269 run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;271 data workingdata1;&lt;BR /&gt;272 Set work.workingdata;&lt;BR /&gt;273 Format CIK $10.;&lt;BR /&gt;WARNING: Variable CIK has already been defined as numeric.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This now shows up. How do I orignally format CIK as numeric---need it to be character since I need the leading zeros. Numeric gets rid of the leading zeros.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 26 Sep 2017 21:25:30 GMT</pubDate>
    <dc:creator>dlazer1</dc:creator>
    <dc:date>2017-09-26T21:25:30Z</dc:date>
    <item>
      <title>How to format character variable from excel data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-format-character-variable-from-excel-data/m-p/398947#M96566</link>
      <description>&lt;P&gt;Below is the code I have but I am getting no observations once I do this step. Please help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data workingdata;&lt;BR /&gt;set work.test;&lt;BR /&gt;Format CIK $10;&lt;/P&gt;&lt;P&gt;IF COMPANY_FKEY&amp;lt;=9999 THEN CIK =cats('000000',COMPANY_FKEY);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to create all these values as 10 digits with leading 0's.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do I need to define company_fkey before?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 21:07:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-format-character-variable-from-excel-data/m-p/398947#M96566</guid>
      <dc:creator>dlazer1</dc:creator>
      <dc:date>2017-09-26T21:07:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to format character variable from excel data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-format-character-variable-from-excel-data/m-p/398950#M96569</link>
      <description>&lt;P&gt;Make sure there is a period ('.') after your format... so it should look like FORMAT CIK $10.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And yes, the variable COMPANY_FKEY needs to be defined in the work.test dataset &amp;nbsp;if you are going to test its value in the workingdata data step.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 21:17:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-format-character-variable-from-excel-data/m-p/398950#M96569</guid>
      <dc:creator>JasonDiVirgilio</dc:creator>
      <dc:date>2017-09-26T21:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to format character variable from excel data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-format-character-variable-from-excel-data/m-p/398952#M96571</link>
      <description>&lt;P&gt;data workingdata;&lt;BR /&gt;267 Set work.test;&lt;BR /&gt;268 COMPANY_FKEY=CIK;&lt;BR /&gt;269 run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;271 data workingdata1;&lt;BR /&gt;272 Set work.workingdata;&lt;BR /&gt;273 Format CIK $10.;&lt;BR /&gt;WARNING: Variable CIK has already been defined as numeric.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This now shows up. How do I orignally format CIK as numeric---need it to be character since I need the leading zeros. Numeric gets rid of the leading zeros.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 21:25:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-format-character-variable-from-excel-data/m-p/398952#M96571</guid>
      <dc:creator>dlazer1</dc:creator>
      <dc:date>2017-09-26T21:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to format character variable from excel data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-format-character-variable-from-excel-data/m-p/398955#M96573</link>
      <description>&lt;P&gt;You can't change the type of the variable, you can only replace it by creating a new variable and using rename= and drop= dataset options.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 21:30:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-format-character-variable-from-excel-data/m-p/398955#M96573</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-09-26T21:30:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to format character variable from excel data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-format-character-variable-from-excel-data/m-p/398961#M96577</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/167782"&gt;@dlazer1&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;data workingdata;&lt;BR /&gt;267 Set work.test;&lt;BR /&gt;268 COMPANY_FKEY=CIK; &lt;FONT color="#ff0000"&gt;Since CIK already exists here it seems that it was created or made numeric when work.test was created.&lt;/FONT&gt;&lt;BR /&gt;269 run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;271 data workingdata1;&lt;BR /&gt;272 Set work.workingdata;&lt;BR /&gt;273 Format CIK $10.;&lt;BR /&gt;WARNING: Variable CIK has already been defined as numeric.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This now shows up. How do I orignally format CIK as numeric---need it to be character since I need the leading zeros. Numeric gets rid of the leading zeros.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you have a numeric variable and need to create a character version then use&lt;/P&gt;
&lt;P&gt;Charversion = put(numericversion, Z10.);&lt;/P&gt;
&lt;P&gt;the Z format pads the displayed value with leading zeroes to the number of spaces indicated in the format. If the variable has a value of 123 and you use the Z10 it will display, or with put statement as shown create, 0000000123&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 21:56:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-format-character-variable-from-excel-data/m-p/398961#M96577</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-09-26T21:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to format character variable from excel data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-format-character-variable-from-excel-data/m-p/398972#M96580</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 26 Sep 2017 23:15:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-format-character-variable-from-excel-data/m-p/398972#M96580</guid>
      <dc:creator>dlazer1</dc:creator>
      <dc:date>2017-09-26T23:15:34Z</dc:date>
    </item>
  </channel>
</rss>

