<?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: Converting from numeric to variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Converting-from-numeric-to-variable/m-p/619015#M181663</link>
    <description>&lt;P&gt;Using a SAS data step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set data.master(rename=(studentID=studentIDNum));
  studentID=put(studentIDNum,z5.);
  drop studentIDNum;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 22 Jan 2020 01:48:51 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2020-01-22T01:48:51Z</dc:date>
    <item>
      <title>Converting from numeric to variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-from-numeric-to-variable/m-p/619009#M181659</link>
      <description>&lt;P&gt;Hello! I am new to sas! How could I accomplish this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Someone wants to join the Data.master file to another table using student ID. However, the studentID column in the table to be joined is a character variable. Convert the numeric student ID variable in the master file to be a character variable. Write this new file to the work library.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Data.master.PNG" style="width: 397px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/35540i9E33CEAA300829D0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Data.master.PNG" alt="Data.master.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data.master screenshot:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Data.master Datafile.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/35541i940D7533951F5B5D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Data.master Datafile.PNG" alt="Data.master Datafile.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 00:39:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-from-numeric-to-variable/m-p/619009#M181659</guid>
      <dc:creator>cneed</dc:creator>
      <dc:date>2020-01-22T00:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: Converting from numeric to variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-from-numeric-to-variable/m-p/619012#M181661</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/308061"&gt;@cneed&lt;/a&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will work:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql ;                                                                                                                                       
  create table converted as select input (studentid, best.) as studentid, * from have ;                                                          
quit ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;However, you will get the warning:&lt;/P&gt;
&lt;PRE&gt;WARNING: Variable studentid already exists on file WORK.CONVERTED.
&lt;/PRE&gt;
&lt;P&gt;This will work, too - but you will not get the warning:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql ;                                                                                                                                       
  create table converted (drop=_id) as select input (_id, best.) as studentid, * from have (rename=studentid=_id) ;                              
quit ; 
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Kind regards&lt;/P&gt;
&lt;P&gt;Paul D.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 01:17:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-from-numeric-to-variable/m-p/619012#M181661</guid>
      <dc:creator>hashman</dc:creator>
      <dc:date>2020-01-22T01:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: Converting from numeric to variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-from-numeric-to-variable/m-p/619014#M181662</link>
      <description>&lt;P&gt;I like the smart REnaming upfront and make the &lt;STRONG&gt;select * work.&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tell you what, up until this point I have been so lazy and relying on FEEDBACK NOEXEC options to copy paste the expanded SELECT clause written to the LOG. Hmm, i will keep in mind to copy the new idea.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql feedback noexec;
select *
from sashelp.class;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Jan 2020 01:33:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-from-numeric-to-variable/m-p/619014#M181662</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2020-01-22T01:33:33Z</dc:date>
    </item>
    <item>
      <title>Re: Converting from numeric to variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Converting-from-numeric-to-variable/m-p/619015#M181663</link>
      <description>&lt;P&gt;Using a SAS data step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set data.master(rename=(studentID=studentIDNum));
  studentID=put(studentIDNum,z5.);
  drop studentIDNum;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Jan 2020 01:48:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Converting-from-numeric-to-variable/m-p/619015#M181663</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-01-22T01:48:51Z</dc:date>
    </item>
  </channel>
</rss>

