<?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: CHAR to NUMERIC in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/CHAR-to-NUMERIC/m-p/239588#M55534</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P&gt;Library names may only have 8 characters. MyLibrary has 9 so in valid.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also your error message:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;ERROR: La Libref MyLybrary&amp;nbsp; references a differently spelled library than your Libname statement (still too long), and the code used:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;SPAN class="token statement"&gt;select&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;*&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;from&lt;/SPAN&gt; MyLbrary&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;mydataset &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;which has a different library than the error message, so there's something else missing from your displayed code.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 16 Dec 2015 18:04:35 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2015-12-16T18:04:35Z</dc:date>
    <item>
      <title>CHAR to NUMERIC</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/CHAR-to-NUMERIC/m-p/235997#M55187</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;i have to do a simply ( still not for me ) modify on an existing dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would change the format of a column from CHAR&amp;nbsp;to NUMERIC.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Searching into&amp;nbsp;SAS library, i seen the INPUT statement which i used to set a new column.&amp;nbsp; Actually I&amp;nbsp;don't know how to modify an existant column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can someone help me&amp;nbsp;?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thanks in advance,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;D.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2015 15:19:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/CHAR-to-NUMERIC/m-p/235997#M55187</guid>
      <dc:creator>Davi3</dc:creator>
      <dc:date>2015-11-23T15:19:01Z</dc:date>
    </item>
    <item>
      <title>Re: CHAR to NUMERIC</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/CHAR-to-NUMERIC/m-p/236008#M55189</link>
      <description>&lt;P&gt;Basically you cannot change variable type in an existing dataset. The general approach is to create a new data set as needed.&lt;/P&gt;
&lt;P&gt;Generic code to do something like that is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set have (rename= (charactervariablename= oldvar));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; input charactervariablename = input (oldvar,best32.); /* or if you have a specific informat planned use it*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp; drop oldvar;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would not recommend overwriting the existing have data set until verifying everything is correct. Then rename the Want to the existing set.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2015 15:50:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/CHAR-to-NUMERIC/m-p/236008#M55189</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-11-23T15:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: CHAR to NUMERIC</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/CHAR-to-NUMERIC/m-p/236009#M55190</link>
      <description>When changing types a new variable name is required.  If you need   to keep the original variable name, use the RENAME= option on  &lt;BR /&gt; the SET statement to rename the variable as it comes into the PDV. &lt;BR /&gt;This allows the original variable name to be reused when you change type.                                                       &lt;BR /&gt;</description>
      <pubDate>Mon, 23 Nov 2015 15:51:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/CHAR-to-NUMERIC/m-p/236009#M55190</guid>
      <dc:creator>pearsoninst</dc:creator>
      <dc:date>2015-11-23T15:51:07Z</dc:date>
    </item>
    <item>
      <title>Re: CHAR to NUMERIC</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/CHAR-to-NUMERIC/m-p/236149#M55202</link>
      <description>&lt;P&gt;SAS has two data types: CHARACTER and NUMERIC&lt;/P&gt;
&lt;P&gt;Data types determine how data gets stored and you can't change the type. You can only create a new column (variable), convert the values to the format of the new type, assign these values to the new column and then drop the old column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Most of the time you don't need to go down this path. If you're only interested how the values of a variable "print" then use a format. No need to change the type.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unlike the type and length of a variable, a format is an attribut which you can change via a modify statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you tell us a bit more in detail what you have and what you need then we'll be able to give you the right advice.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2015 09:36:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/CHAR-to-NUMERIC/m-p/236149#M55202</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-11-24T09:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: CHAR to NUMERIC</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/CHAR-to-NUMERIC/m-p/236191#M55204</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks a lot for your answers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From your precious answers i can recap these logical steps:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) rename the old variable&lt;/P&gt;
&lt;P&gt;2) create a new&amp;nbsp;variable with right format&lt;/P&gt;
&lt;P&gt;3) put into the new variable the value of the old variable&lt;/P&gt;
&lt;P&gt;4) drop the old variable&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I still have difficult to understand how do this on my scenario:&amp;nbsp; I have X dataset which are used from X query into Visual Analytics.&lt;/P&gt;
&lt;P&gt;The dataset is created by a script like&amp;nbsp;the following one which read&amp;nbsp;values&amp;nbsp;from a csv and write ( in append mode&amp;nbsp;) on a dataset&amp;nbsp;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname MyLibrary 'C:\LibFolder';
      data work.MyDataset    ;
      %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
      infile 'C:\import\myfile.csv' delimiter = ';' MISSOVER DSD lrecl=32767 firstobs=2 ;
	     
         informat var1 yymmdd8.;
         informat var2 best32.;
         informat var3 $2.;
         informat var4 $1.;
         informat var5 $2.;
		 
         format var1 yymmdd8.;
         format var2 best32.;
         format var3 $2.;
         format var4 $1.;
         format var5 $2.;

         input
                var1 
	var2 
	var3 $
	var4 $
	var5 $

      ;
      if _ERROR_ then call symputx('_EFIERR_',1);  /* set ERROR detection macro variable */
      run;
	  
proc append base=MyLibrary.MyDataset data=work.MyDataset;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If i do a a simply Select *&amp;nbsp;from SAS compiler like the following one, i receive&amp;nbsp;ERROR: La Libref MyLybrary is not assigned into the log&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select * from MyLbrary.mydataset ;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So just to do the first step..... What i wrong ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2015 13:30:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/CHAR-to-NUMERIC/m-p/236191#M55204</guid>
      <dc:creator>Davi3</dc:creator>
      <dc:date>2015-11-24T13:30:05Z</dc:date>
    </item>
    <item>
      <title>Re: CHAR to NUMERIC</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/CHAR-to-NUMERIC/m-p/236204#M55207</link>
      <description>&lt;P&gt;Sounds like a new question.&lt;/P&gt;
&lt;P&gt;If you are getting an error that the library is not assigned then check the LIBNAME statement that created the library. Is the path you specified correct? &amp;nbsp;Is it visible from the computer that is running SAS? In many installations SAS is actually running on a Unix machine and directory name with C: at the beginning will never work on a Unix machine.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2015 14:55:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/CHAR-to-NUMERIC/m-p/236204#M55207</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-11-24T14:55:41Z</dc:date>
    </item>
    <item>
      <title>Re: CHAR to NUMERIC</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/CHAR-to-NUMERIC/m-p/239588#M55534</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P&gt;Library names may only have 8 characters. MyLibrary has 9 so in valid.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also your error message:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;ERROR: La Libref MyLybrary&amp;nbsp; references a differently spelled library than your Libname statement (still too long), and the code used:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;SPAN class="token statement"&gt;select&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;*&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;from&lt;/SPAN&gt; MyLbrary&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;mydataset &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;which has a different library than the error message, so there's something else missing from your displayed code.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Dec 2015 18:04:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/CHAR-to-NUMERIC/m-p/239588#M55534</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-12-16T18:04:35Z</dc:date>
    </item>
  </channel>
</rss>

