<?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: Keep leading zeros in stored process in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Keep-leading-zeros-in-stored-process/m-p/595323#M171236</link>
    <description>&lt;P&gt;Thank you for replying. This doesn't help. My input (VESTIGINGSNUMMER)&amp;nbsp; is a character ($12.). Excel makes it a number, but it must stay a character.&lt;/P&gt;</description>
    <pubDate>Thu, 10 Oct 2019 11:08:34 GMT</pubDate>
    <dc:creator>u38109150</dc:creator>
    <dc:date>2019-10-10T11:08:34Z</dc:date>
    <item>
      <title>Keep leading zeros in stored process</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-leading-zeros-in-stored-process/m-p/595290#M171226</link>
      <description>&lt;P&gt;I create a repport with a stored process.&lt;BR /&gt;I use SQL.&lt;BR /&gt;I run this process with reports on in sas add-in for Excel.&lt;BR /&gt;In this reports are numbers beginnen with zero, like 000048383.&lt;BR /&gt;I will keep this zeros.&lt;BR /&gt;I think i should slove this in the stored proces tab "Data Sources and Targets. But I do'nt know how.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code&amp;nbsp; is like this.&lt;/P&gt;&lt;P&gt;VESTIGINGSNR is like 000047178622 format&amp;nbsp; $12.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;SELECT DISTINCT&lt;BR /&gt;FORMULE.HANDELSNAAM label="Handelsnaam",&lt;BR /&gt;FORMULE.NAW label="Adres",&lt;BR /&gt;FORMULE.VESTIGINGSNUMMER AS VESTIGINGSNR label="Vestigingsnummer"&lt;BR /&gt;FROM AIDDWH.REF_FORMULEBEDRIJF AS FORMULE&lt;BR /&gt;;&lt;BR /&gt;QUIT;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 11:09:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-leading-zeros-in-stored-process/m-p/595290#M171226</guid>
      <dc:creator>u38109150</dc:creator>
      <dc:date>2019-10-10T11:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: Keep leading zeros in stored process</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-leading-zeros-in-stored-process/m-p/595310#M171230</link>
      <description>Just add FORMAT=Z9. ie.: &lt;BR /&gt;label="Vestigingsnummer" format=z9.</description>
      <pubDate>Thu, 10 Oct 2019 10:38:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-leading-zeros-in-stored-process/m-p/595310#M171230</guid>
      <dc:creator>MichaelLarsen</dc:creator>
      <dc:date>2019-10-10T10:38:05Z</dc:date>
    </item>
    <item>
      <title>Re: Keep leading zeros in stored process</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-leading-zeros-in-stored-process/m-p/595323#M171236</link>
      <description>&lt;P&gt;Thank you for replying. This doesn't help. My input (VESTIGINGSNUMMER)&amp;nbsp; is a character ($12.). Excel makes it a number, but it must stay a character.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 11:08:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-leading-zeros-in-stored-process/m-p/595323#M171236</guid>
      <dc:creator>u38109150</dc:creator>
      <dc:date>2019-10-10T11:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: Keep leading zeros in stored process</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-leading-zeros-in-stored-process/m-p/595325#M171237</link>
      <description>&lt;P&gt;I have not tested it, but can you try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
SELECT DISTINCT
FORMULE.NAAM label="Nalevingssoort",
FORMULE.HANDELSNAAM label="Handelsnaam",
FORMULE.NAW label="Adres",
catt("'",FORMULE.VESTIGINGSNUMMER AS VESTIGINGSNR) label="Vestigingsnummer"
FROM AIDDWH.REF_FORMULEBEDRIJF AS FORMULE
;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I am assuming that the leading zeroes are already present in the input table.&lt;/P&gt;
&lt;P&gt;You can also take a look at the ODS EXCEL documentation it offers you more flexibility:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?docsetId=odsug&amp;amp;docsetTarget=p09n5pw9ol0897n1qe04zeur27rv.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en"&gt;https://documentation.sas.com/?docsetId=odsug&amp;amp;docsetTarget=p09n5pw9ol0897n1qe04zeur27rv.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 11:15:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-leading-zeros-in-stored-process/m-p/595325#M171237</guid>
      <dc:creator>MichaelLarsen</dc:creator>
      <dc:date>2019-10-10T11:15:51Z</dc:date>
    </item>
    <item>
      <title>Re: Keep leading zeros in stored process</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-leading-zeros-in-stored-process/m-p/595329#M171239</link>
      <description>&lt;P&gt;sorry there is a syntax error, try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
SELECT DISTINCT
FORMULE.NAAM label="Nalevingssoort",
FORMULE.HANDELSNAAM label="Handelsnaam",
FORMULE.NAW label="Adres",
catt("'",FORMULE.VESTIGINGSNUMMER) AS VESTIGINGSNR label="Vestigingsnummer"
FROM AIDDWH.REF_FORMULEBEDRIJF AS FORMULE
;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Oct 2019 11:24:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-leading-zeros-in-stored-process/m-p/595329#M171239</guid>
      <dc:creator>MichaelLarsen</dc:creator>
      <dc:date>2019-10-10T11:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: Keep leading zeros in stored process</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-leading-zeros-in-stored-process/m-p/595337#M171241</link>
      <description>&lt;P&gt;Yes Thank you this works.&lt;/P&gt;&lt;P&gt;And I don't see the qoute (') in the Excel output.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 11:40:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-leading-zeros-in-stored-process/m-p/595337#M171241</guid>
      <dc:creator>u38109150</dc:creator>
      <dc:date>2019-10-10T11:40:16Z</dc:date>
    </item>
    <item>
      <title>Re: Keep leading zeros in stored process</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-leading-zeros-in-stored-process/m-p/595362#M171249</link>
      <description>&lt;P&gt;Why doesn't it know that the variable is character and keep the results in Excel as character?&lt;/P&gt;
&lt;P&gt;Is there something broken in the SAS Add-in to Excel?&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 12:53:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-leading-zeros-in-stored-process/m-p/595362#M171249</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-10T12:53:38Z</dc:date>
    </item>
    <item>
      <title>Re: Keep leading zeros in stored process</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-leading-zeros-in-stored-process/m-p/595365#M171250</link>
      <description>No, I think Excel is just trying to be helpful.&lt;BR /&gt;You can try and enter the value 000048383 into an empty cell and you will see the same problem. &lt;BR /&gt;Adding the quote as the first character forces Excel to regard the value as a character value.</description>
      <pubDate>Thu, 10 Oct 2019 12:59:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-leading-zeros-in-stored-process/m-p/595365#M171250</guid>
      <dc:creator>MichaelLarsen</dc:creator>
      <dc:date>2019-10-10T12:59:17Z</dc:date>
    </item>
    <item>
      <title>Re: Keep leading zeros in stored process</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-leading-zeros-in-stored-process/m-p/595370#M171254</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/24960"&gt;@MichaelLarsen&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;No, I think Excel is just trying to be helpful.&lt;BR /&gt;You can try and enter the value 000048383 into an empty cell and you will see the same problem. &lt;BR /&gt;Adding the quote as the first character forces Excel to regard the value as a character value.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If I create an Excel file from normal SAS using tools like PROC EXPORT or XLSX engine on a libname it knows the variable is character and I don't have to play tricks with the values to get Excel to display it properly.&lt;/P&gt;
&lt;P&gt;And in Excel itself if I set the type for a cell as text and enter a value with leading zeros it displays them properly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the question is why does pulling data with the Excel Add-In not also know that the variable being pulled is character?&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 13:08:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-leading-zeros-in-stored-process/m-p/595370#M171254</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-10T13:08:14Z</dc:date>
    </item>
    <item>
      <title>Re: Keep leading zeros in stored process</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-leading-zeros-in-stored-process/m-p/595403#M171270</link>
      <description>&lt;P&gt;This is a tricky one where there are two schools of thought on how this should work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A) The data is marked as character data, so when it goes into Excel, we should treat it as text.&amp;nbsp; This is the ideal solution for the user who wants to see their data in Excel exactly as they see it in their generated results.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;B) The data is marked as character data, but Excel can interpret it differently, we should let Excel interpret it.&amp;nbsp; This is the ideal solution for someone who wants to continue to explore their data with Excel.&amp;nbsp; If Excel is able to interpret the data as a number or date, then the user can use Excel formulas to continue to work with their data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As with many of these situations, we decided to add an option in the SAS Add-In for Microsoft Office to handle this.&amp;nbsp; If you set your result format to SAS Report Xml, then the add-in has control over the format of the cell.&amp;nbsp; We decide whether to force the format to Text or leave it as General based on an option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's how to get to this option:&lt;/P&gt;
&lt;P&gt;From the SAS tab on the ribbon, go to Tools-&amp;gt;Options.&amp;nbsp; On the options dialog go to the Results page and scroll to the bottom.&amp;nbsp; There's a group called "Tables".&amp;nbsp; Inside of that group is an option called "Allow Excel to interpret value types in SAS Report tables".&amp;nbsp; By changing the value of this option, you can get the results you desire the next time you open a new instance of that stored process.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have content already inserted, then you'll need to either remove it and insert a new instance of the stored process.&amp;nbsp; Or change the settings for that content.&amp;nbsp; You can do this by setting the format of the cells to Text manually.&amp;nbsp; Then, while that content is selected, choose SAS-&amp;gt;Properties.&amp;nbsp; On the Properties dialog, choose the Appearance tab and check "Preserve Excel number formatting".&amp;nbsp; This will instruct us to NOT change the format on the cells when refreshing this content.&amp;nbsp; You can set it up how you want it and the Add-In will not change it during a refresh.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;Tim Beese&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 13:57:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-leading-zeros-in-stored-process/m-p/595403#M171270</guid>
      <dc:creator>TimBeese</dc:creator>
      <dc:date>2019-10-10T13:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: Keep leading zeros in stored process</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-leading-zeros-in-stored-process/m-p/595407#M171273</link>
      <description>&lt;P&gt;Yes, thank you, this helps too.&lt;/P&gt;&lt;P&gt;This is even a better solution.&lt;/P&gt;&lt;P&gt;My Users need to do the same thing. That won’t be a problem I suppose.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 14:08:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-leading-zeros-in-stored-process/m-p/595407#M171273</guid>
      <dc:creator>u38109150</dc:creator>
      <dc:date>2019-10-10T14:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: Keep leading zeros in stored process</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-leading-zeros-in-stored-process/m-p/595410#M171275</link>
      <description>&lt;P&gt;Much better answer.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 14:15:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-leading-zeros-in-stored-process/m-p/595410#M171275</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-10T14:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: Keep leading zeros in stored process</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-leading-zeros-in-stored-process/m-p/595411#M171276</link>
      <description>&lt;P&gt;You tagged the wrong answer as the solution.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2019 14:20:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-leading-zeros-in-stored-process/m-p/595411#M171276</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-10T14:20:10Z</dc:date>
    </item>
  </channel>
</rss>

