<?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: SAS Base Query in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Query/m-p/337690#M76732</link>
    <description>&lt;P&gt;In your output ID1 is numeric while ID is char type.&lt;/P&gt;
&lt;P&gt;Your code is the easyiest way to bo done;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Mar 2017 01:52:41 GMT</pubDate>
    <dc:creator>Shmuel</dc:creator>
    <dc:date>2017-03-03T01:52:41Z</dc:date>
    <item>
      <title>SAS Base Query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Query/m-p/337689#M76731</link>
      <description>&lt;P&gt;The below codes is working fine.&amp;nbsp; Just want to know if there is any way to have to same result without RENAME and DROP variables? Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA A;&lt;BR /&gt;INFILE CARDS;&lt;BR /&gt;INPUT ID ;&lt;BR /&gt;CARDS;&lt;BR /&gt;3453&lt;BR /&gt;123162&lt;BR /&gt;124171&lt;BR /&gt;1241761&lt;BR /&gt;;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;DATA A(RENAME=(ID1=ID));&lt;BR /&gt;SET A;&lt;BR /&gt;ID1 = PUT(ID,z7.);&lt;BR /&gt;DROP ID;&lt;BR /&gt;RUN;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 01:47:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Query/m-p/337689#M76731</guid>
      <dc:creator>scb</dc:creator>
      <dc:date>2017-03-03T01:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Base Query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Query/m-p/337690#M76732</link>
      <description>&lt;P&gt;In your output ID1 is numeric while ID is char type.&lt;/P&gt;
&lt;P&gt;Your code is the easyiest way to bo done;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 01:52:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Query/m-p/337690#M76732</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-03-03T01:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Base Query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Query/m-p/337701#M76737</link>
      <description>&lt;P&gt;Do it in a single step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA A;
INFILE CARDS;
INPUT ID :$7. ;
id = translate(right(id),"0"," ");
CARDS;
3453
123162
124171
1241761
;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 04:00:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Query/m-p/337701#M76737</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-03-03T04:00:16Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Base Query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Query/m-p/337750#M76760</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;, you probably know that input a CHAR type is &lt;STRONG&gt;left&lt;/STRONG&gt; aligned.&lt;/P&gt;
&lt;P&gt;Then&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA A;
INFILE CARDS;
INPUT ID :$7. ;
id = translate(right(id),"0"," ");
CARDS;
3453
; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will create ID=&lt;STRONG&gt;'3453000'&lt;/STRONG&gt; while the equivalent to the number 3453 is&lt;STRONG&gt; '0003453'&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this case, it can be done by:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA A;
INFILE CARDS;
INPUT ID :$7. ;
id = put(input(id,best7.),z7.);
CARDS;
3453
; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 09:05:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Query/m-p/337750#M76760</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-03-03T09:05:57Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Base Query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Query/m-p/337756#M76763</link>
      <description>&lt;P&gt;Sorry&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;&amp;nbsp;that may not be 100% correct. &amp;nbsp;It depends on what the OP user is expecting from the variable. &amp;nbsp;If they really do want a text field then I have no problem with it. &amp;nbsp;If however they just want that data as z7. then the simplest method is to apply the format to the already existing numeric data:&lt;/P&gt;
&lt;PRE&gt;data a;
  infile cards;
  input id;
  format id z7.;   /* &amp;lt;-- this is the only thing needed to display as z7. */
cards;
3453
123162
124171
1241761
;
run;&lt;/PRE&gt;
&lt;P&gt;OP: Please do not code all in upper case, it really makes code so much harder to look at.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 09:39:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Query/m-p/337756#M76763</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-03-03T09:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Base Query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Query/m-p/337763#M76768</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;, you are right if the target was just &lt;STRONG&gt;displaying&lt;/STRONG&gt; the number with leading zeroes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The original query included code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA A(RENAME=(ID1=ID));
SET A;
ID1 = PUT(ID,z7.);
DROP ID;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Which I understand that the target is&lt;STRONG&gt; changing type of variable in a dataset&lt;/STRONG&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 10:10:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Query/m-p/337763#M76768</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-03-03T10:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Base Query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Query/m-p/337871#M76806</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;, you are right in saying that input reads left aligned, which is why I use the&lt;STRONG&gt; right&lt;/STRONG&gt; function to make it right aligned before replacing the spaces with leading zeros.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 15:42:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Query/m-p/337871#M76806</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-03-03T15:42:46Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Base Query</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Query/m-p/338017#M76846</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;, you are right, I skiped the&amp;nbsp;&lt;STRONG&gt;right&lt;/STRONG&gt; in your code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any way, our debate is a good lesson to SAS starting users.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 21:17:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Base-Query/m-p/338017#M76846</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-03-03T21:17:28Z</dc:date>
    </item>
  </channel>
</rss>

