<?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: adding zero '0' in front of variable 'telno' in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/adding-zero-0-in-front-of-variable-telno/m-p/90222#M8420</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If telno is numeric, you can't store the telno with leading 0, that's how SAS (and most other SW) does.&lt;/P&gt;&lt;P&gt;If you like, you could apply the Z&lt;EM&gt;n&lt;/EM&gt;. format to your column, but you can't do that dependent on values in other columns.&lt;/P&gt;&lt;P&gt;So I guess you need to create a new telno char column to fulfill your requirement. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 28 Mar 2013 08:05:56 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2013-03-28T08:05:56Z</dc:date>
    <item>
      <title>adding zero '0' in front of variable 'telno'</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/adding-zero-0-in-front-of-variable-telno/m-p/90216#M8414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guys, i have two variable in dataset named '&lt;STRONG&gt;telno&lt;/STRONG&gt;' and '&lt;STRONG&gt;state&lt;/STRONG&gt;', couple of state required zero '0' in front of 'telno' variable. if i wants to add zero '0' for couple of states only, how can i do that?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Mar 2013 16:22:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/adding-zero-0-in-front-of-variable-telno/m-p/90216#M8414</guid>
      <dc:creator>frank1947</dc:creator>
      <dc:date>2013-03-27T16:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: adding zero '0' in front of variable 'telno'</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/adding-zero-0-in-front-of-variable-telno/m-p/90217#M8415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if state in ('NJ','NY'....)&amp;nbsp; then phone=' 0-' || phone;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry i am new to SAS but this is what i'd think of first&lt;/P&gt;&lt;P&gt;I bet phone is&amp;nbsp; a char variable and you specified the length at the top of your code?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Mar 2013 16:41:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/adding-zero-0-in-front-of-variable-telno/m-p/90217#M8415</guid>
      <dc:creator>Tal</dc:creator>
      <dc:date>2013-03-27T16:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: adding zero '0' in front of variable 'telno'</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/adding-zero-0-in-front-of-variable-telno/m-p/90218#M8416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Frank, can you confirm if 'telno' is a char (text value)? If it is, Tal has the right idea. You could do an update using PROC SQL by doing the following:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Open a new SAS Program by right clicking the blank area on a process flow,&amp;nbsp; select new, select Program. Then enter the following code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;PROC SQL;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;UPDATE &lt;SPAN style="text-decoration: underline;"&gt;&lt;EM&gt;WORK&lt;/EM&gt;&lt;/SPAN&gt;.&lt;SPAN style="text-decoration: underline;"&gt;&lt;EM&gt;DATASET&lt;/EM&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;SET telno = '0' || telno&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;WHERE state IN ('state1','state2');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;QUIT;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Just change &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em; text-decoration: underline;"&gt;&lt;EM&gt;WORK&lt;/EM&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em; text-decoration: underline;"&gt;&lt;EM&gt;DATASET&lt;/EM&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; to the name of your data set and change the states and you should be able to run the code. There are other ways to do this as well, I just chose the first one to come to mind.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Mar 2013 18:25:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/adding-zero-0-in-front-of-variable-telno/m-p/90218#M8416</guid>
      <dc:creator>audioa84</dc:creator>
      <dc:date>2013-03-27T18:25:39Z</dc:date>
    </item>
    <item>
      <title>Re: adding zero '0' in front of variable 'telno'</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/adding-zero-0-in-front-of-variable-telno/m-p/90219#M8417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi audioa84, i think concatenation (||) requires character operands and zcta is a numeric variable so it could updated with a numeric expression only...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Mar 2013 19:21:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/adding-zero-0-in-front-of-variable-telno/m-p/90219#M8417</guid>
      <dc:creator>frank1947</dc:creator>
      <dc:date>2013-03-27T19:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: adding zero '0' in front of variable 'telno'</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/adding-zero-0-in-front-of-variable-telno/m-p/90220#M8418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No problem, but I think you replied on the wrong thread. There is no mention of zcta on this thread.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Mar 2013 19:26:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/adding-zero-0-in-front-of-variable-telno/m-p/90220#M8418</guid>
      <dc:creator>audioa84</dc:creator>
      <dc:date>2013-03-27T19:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: adding zero '0' in front of variable 'telno'</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/adding-zero-0-in-front-of-variable-telno/m-p/90221#M8419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ya, i am sorry was working with two datasets together. but 'telno' is numeric so we can apply same logic...Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Mar 2013 19:34:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/adding-zero-0-in-front-of-variable-telno/m-p/90221#M8419</guid>
      <dc:creator>frank1947</dc:creator>
      <dc:date>2013-03-27T19:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: adding zero '0' in front of variable 'telno'</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/adding-zero-0-in-front-of-variable-telno/m-p/90222#M8420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If telno is numeric, you can't store the telno with leading 0, that's how SAS (and most other SW) does.&lt;/P&gt;&lt;P&gt;If you like, you could apply the Z&lt;EM&gt;n&lt;/EM&gt;. format to your column, but you can't do that dependent on values in other columns.&lt;/P&gt;&lt;P&gt;So I guess you need to create a new telno char column to fulfill your requirement. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Mar 2013 08:05:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/adding-zero-0-in-front-of-variable-telno/m-p/90222#M8420</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2013-03-28T08:05:56Z</dc:date>
    </item>
    <item>
      <title>Re: adding zero '0' in front of variable 'telno'</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/adding-zero-0-in-front-of-variable-telno/m-p/90223#M8421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi guys this onw worked&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc sql;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;create table want as&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;select&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; state,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; telno,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cats(case when state in ('s1','s2','s3') then '0' end, telno) as telnoChr&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;from&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; have;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;quit;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Mar 2013 14:12:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/adding-zero-0-in-front-of-variable-telno/m-p/90223#M8421</guid>
      <dc:creator>frank1947</dc:creator>
      <dc:date>2013-03-29T14:12:58Z</dc:date>
    </item>
    <item>
      <title>Re: adding zero '0' in front of variable 'telno'</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/adding-zero-0-in-front-of-variable-telno/m-p/90224#M8422</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Guys,&lt;/P&gt;&lt;P&gt;I have a character variable which has values like (9945,99,0954) and I want to make variable values like (9945,099,0954).&lt;/P&gt;&lt;P&gt;I want to insert a leading zero if my character variable is of length two. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am wondering if you can help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2013 13:41:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/adding-zero-0-in-front-of-variable-telno/m-p/90224#M8422</guid>
      <dc:creator>learner_sas</dc:creator>
      <dc:date>2013-04-04T13:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: adding zero '0' in front of variable 'telno'</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/adding-zero-0-in-front-of-variable-telno/m-p/90225#M8423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do var='9945','99','0954';&lt;/P&gt;&lt;P&gt;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var=ifc(length(var)=2,'0'||var,var);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2013 13:50:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/adding-zero-0-in-front-of-variable-telno/m-p/90225#M8423</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2013-04-04T13:50:54Z</dc:date>
    </item>
  </channel>
</rss>

