<?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: PROC IMPORT - force all values to character in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-IMPORT-force-all-values-to-character/m-p/940686#M369199</link>
    <description>&lt;P&gt;If you are importing an EXCEL file and the header row has NAMES then it usually works to use GETNAMES=NO so that it treats the first observation as data.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import file=xlsx dbms=xlsx out=want replace;
  getnames=no;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can then use the first observation to generate code to rename the variables if you want and at the same time delete that observation.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=want(obs=1) out=names ;
  var _all_;
run;
proc sql noprint;
  select catx('=',_name_,nliteral(col1)) into :renames separated by ' '
  from names;
quit;

data want;
  set want(firstobs=2);
  rename &amp;amp;renames;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 25 Aug 2024 17:50:03 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2024-08-25T17:50:03Z</dc:date>
    <item>
      <title>PROC IMPORT - force all values to character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-IMPORT-force-all-values-to-character/m-p/940674#M369196</link>
      <description>&lt;P&gt;How can I force proc import to create all character variables in the output dataset from the Excel workbook?&lt;/P&gt;
&lt;P&gt;I can also get a csv version if that makes it easier.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The spreadsheet I'm working with has several hundred columns and most have numeric values, but in some, dashes exist.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2024 22:47:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-IMPORT-force-all-values-to-character/m-p/940674#M369196</guid>
      <dc:creator>_Hopper</dc:creator>
      <dc:date>2024-08-23T22:47:14Z</dc:date>
    </item>
    <item>
      <title>Re: PROC IMPORT - force all values to character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-IMPORT-force-all-values-to-character/m-p/940675#M369197</link>
      <description>&lt;P&gt;CSV would probably make it easier. Is the - the value for missing that is being interpreted as a character for your numeric variables.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2024 23:02:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-IMPORT-force-all-values-to-character/m-p/940675#M369197</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2024-08-23T23:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: PROC IMPORT - force all values to character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-IMPORT-force-all-values-to-character/m-p/940686#M369199</link>
      <description>&lt;P&gt;If you are importing an EXCEL file and the header row has NAMES then it usually works to use GETNAMES=NO so that it treats the first observation as data.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import file=xlsx dbms=xlsx out=want replace;
  getnames=no;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can then use the first observation to generate code to rename the variables if you want and at the same time delete that observation.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=want(obs=1) out=names ;
  var _all_;
run;
proc sql noprint;
  select catx('=',_name_,nliteral(col1)) into :renames separated by ' '
  from names;
quit;

data want;
  set want(firstobs=2);
  rename &amp;amp;renames;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 25 Aug 2024 17:50:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-IMPORT-force-all-values-to-character/m-p/940686#M369199</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-08-25T17:50:03Z</dc:date>
    </item>
  </channel>
</rss>

