<?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 change the length of Num variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-change-the-length-of-Num-variable/m-p/537590#M147877</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/220513"&gt;@hvempati&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;I have a data with numbers like this -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;4259311&lt;BR /&gt;4262311&lt;BR /&gt;18730311&lt;BR /&gt;3000001311&lt;BR /&gt;3000004311&lt;BR /&gt;3000011311&lt;BR /&gt;3000013311&lt;BR /&gt;3000019311&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get these numbers by joining two rows and have a variable name uni_num&lt;BR /&gt;&lt;BR /&gt;I write a macro to loop over all the numbers and create temp table to manipulate each set.&lt;BR /&gt;&lt;BR /&gt;But while running the code it does well for all numbers which have length less than 8 but does not detect the numbers such as&amp;nbsp;3000001311.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table temp_1&amp;amp;i as select * from work.input_for where uni_num = &amp;amp;var.&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where my &amp;amp;var is the number above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was trying to change the length of number format but with no luck.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Can anyone help me with this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Your question is unclear.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Forcing me to guess, I'd say you have a dataset containing:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;4259311&lt;BR /&gt;4262311&lt;BR /&gt;18730311&lt;BR /&gt;3000001311&lt;BR /&gt;3000004311&lt;BR /&gt;3000011311&lt;BR /&gt;3000013311&lt;BR /&gt;3000019311&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And another dataset containing records where uni_num = one of those values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And you're trying to create separate datasets filtered on those numbers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Questions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) Why?&amp;nbsp; Are you familiar with BY group processing?&lt;/P&gt;&lt;P&gt;2) I suspect creating views rather than tables would give better performance unless your data volume is small.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are numerous ways to split your data, but first can you say why you need to?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And perhaps make your question clearer?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Oh, and as far as making the length of num longer...is it really num or char?&amp;nbsp; If num, and you're converting to char (say into a macro variable), use a format, such as 32. or best32. to override the default format SAS uses to convert a number to character.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Of course, this is me again guessing exactly what you're doing.&amp;nbsp; Regardless, hope this helps...&lt;/P&gt;</description>
    <pubDate>Fri, 22 Feb 2019 03:34:29 GMT</pubDate>
    <dc:creator>ScottBass</dc:creator>
    <dc:date>2019-02-22T03:34:29Z</dc:date>
    <item>
      <title>How to change the length of Num variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-change-the-length-of-Num-variable/m-p/537579#M147871</link>
      <description>&lt;P&gt;I have a data with numbers like this -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;4259311&lt;BR /&gt;4262311&lt;BR /&gt;18730311&lt;BR /&gt;3000001311&lt;BR /&gt;3000004311&lt;BR /&gt;3000011311&lt;BR /&gt;3000013311&lt;BR /&gt;3000019311&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get these numbers by joining two rows and have a variable name uni_num&lt;BR /&gt;&lt;BR /&gt;I write a macro to loop over all the numbers and create temp table to manipulate each set.&lt;BR /&gt;&lt;BR /&gt;But while running the code it does well for all numbers which have length less than 8 but does not detect the numbers such as&amp;nbsp;3000001311.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table temp_1&amp;amp;i as select * from work.input_for where uni_num = &amp;amp;var.&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where my &amp;amp;var is the number above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was trying to change the length of number format but with no luck.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Can anyone help me with this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 02:48:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-change-the-length-of-Num-variable/m-p/537579#M147871</guid>
      <dc:creator>hvempati</dc:creator>
      <dc:date>2019-02-22T02:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to change the length of Num variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-change-the-length-of-Num-variable/m-p/537588#M147876</link>
      <description>&lt;P&gt;Does the length option in proc sql solve your problem?Example:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;sql&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
create &lt;SPAN class="token statement"&gt;table&lt;/SPAN&gt; myNewData as
&lt;SPAN class="token statement"&gt;select&lt;/SPAN&gt;
	&lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;numberStr&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; best&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; as myNumber&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;
	shortStr as longStr &lt;SPAN class="token function"&gt;length&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;32&lt;/SPAN&gt;
&lt;SPAN class="token keyword"&gt;from&lt;/SPAN&gt; myData&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;quit&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 03:29:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-change-the-length-of-Num-variable/m-p/537588#M147876</guid>
      <dc:creator>eduardo_silva</dc:creator>
      <dc:date>2019-02-22T03:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to change the length of Num variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-change-the-length-of-Num-variable/m-p/537590#M147877</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/220513"&gt;@hvempati&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;I have a data with numbers like this -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;4259311&lt;BR /&gt;4262311&lt;BR /&gt;18730311&lt;BR /&gt;3000001311&lt;BR /&gt;3000004311&lt;BR /&gt;3000011311&lt;BR /&gt;3000013311&lt;BR /&gt;3000019311&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get these numbers by joining two rows and have a variable name uni_num&lt;BR /&gt;&lt;BR /&gt;I write a macro to loop over all the numbers and create temp table to manipulate each set.&lt;BR /&gt;&lt;BR /&gt;But while running the code it does well for all numbers which have length less than 8 but does not detect the numbers such as&amp;nbsp;3000001311.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table temp_1&amp;amp;i as select * from work.input_for where uni_num = &amp;amp;var.&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where my &amp;amp;var is the number above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was trying to change the length of number format but with no luck.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Can anyone help me with this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Your question is unclear.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Forcing me to guess, I'd say you have a dataset containing:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;4259311&lt;BR /&gt;4262311&lt;BR /&gt;18730311&lt;BR /&gt;3000001311&lt;BR /&gt;3000004311&lt;BR /&gt;3000011311&lt;BR /&gt;3000013311&lt;BR /&gt;3000019311&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And another dataset containing records where uni_num = one of those values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And you're trying to create separate datasets filtered on those numbers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Questions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) Why?&amp;nbsp; Are you familiar with BY group processing?&lt;/P&gt;&lt;P&gt;2) I suspect creating views rather than tables would give better performance unless your data volume is small.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are numerous ways to split your data, but first can you say why you need to?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And perhaps make your question clearer?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Oh, and as far as making the length of num longer...is it really num or char?&amp;nbsp; If num, and you're converting to char (say into a macro variable), use a format, such as 32. or best32. to override the default format SAS uses to convert a number to character.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Of course, this is me again guessing exactly what you're doing.&amp;nbsp; Regardless, hope this helps...&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 03:34:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-change-the-length-of-Num-variable/m-p/537590#M147877</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-02-22T03:34:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to change the length of Num variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-change-the-length-of-Num-variable/m-p/537613#M147887</link>
      <description>&lt;P&gt;Do not split like data, you will just incur additional read/writes, store data in a larger form of disk (due to header block) and create messy unmaintainable code to try to handle it.&amp;nbsp; SAS has built in functionality to deal with this, its called by group processing, and it is quicker and simpler than anything you come up with.&amp;nbsp; As such this question is moot as you will not be doing this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Next up, post test data in the form of a datastep:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;We cannot see your data and this is a key part in any SAS programming task, you say that is a number, is it numeric or text?&amp;nbsp; Where are you getting it from, what do you want to do with it?&amp;nbsp; Provide what manipulation you want to do (i.e. show input test data, and result) and we can provide code to do it.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 08:05:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-change-the-length-of-Num-variable/m-p/537613#M147887</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2019-02-22T08:05:38Z</dc:date>
    </item>
  </channel>
</rss>

