<?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: variable name with special character how to convert as SAS Standard variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/variable-name-with-special-character-how-to-convert-as-SAS/m-p/733852#M228672</link>
    <description>&lt;P&gt;Since it is a text file just use your own names when reading the data.&lt;/P&gt;
&lt;P&gt;They don't have to be anything like the column headers.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  infile "Sample_data.csv" dsd truncover firstobs=2;
  input id $ var1-var11;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can also make sure to set VALIDVARNAME=V7 and then let PROC IMPORT try to convert the headers into valid names.&amp;nbsp; But then you lose control over not only how the variables are named but also how they are defined.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 14 Apr 2021 17:18:32 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2021-04-14T17:18:32Z</dc:date>
    <item>
      <title>variable name with special character how to convert as SAS Standard variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/variable-name-with-special-character-how-to-convert-as-SAS/m-p/733836#M228669</link>
      <description>&lt;P&gt;&lt;FONT size="4"&gt;Hello Friends,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="4"&gt;I have the attached data set with variables name with special character&amp;nbsp; in csv file such as Q19.1, Q20.1, Q22.1, Q22.2,&amp;nbsp;Q22.3 etc. How can I import these variables as SAS Standard column/variables name?&amp;nbsp;&lt;/FONT&gt;&lt;FONT size="4"&gt;Either in Proc import or in Data step.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="4"&gt;Thank you in advance for your help.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Apr 2021 16:52:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/variable-name-with-special-character-how-to-convert-as-SAS/m-p/733836#M228669</guid>
      <dc:creator>Akter</dc:creator>
      <dc:date>2021-04-14T16:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: variable name with special character how to convert as SAS Standard variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/variable-name-with-special-character-how-to-convert-as-SAS/m-p/733849#M228670</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/369467"&gt;@Akter&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;FONT size="4"&gt;Hello Friends,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;I have the attached data set with variables name with special character&amp;nbsp; in csv file such as Q19.1, Q20.1, Q22.1, Q22.2,&amp;nbsp;Q22.3 etc. How can I import these variables as SAS Standard column/variables name?&amp;nbsp;&lt;/FONT&gt;&lt;FONT size="4"&gt;Either in Proc import or in Data step.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;Thank you in advance for your help.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please see:&lt;/P&gt;
&lt;PRE&gt;data example;
  infile datalines dlm=',';
  input ID :$8. Q19_1 Q20_1 Q22 Q22_1 Q22_2 Q22_3 Q22_4 Q22_5 Q22_6 Q22_7 Q22_8;
datalines;
07-003,3,1,7,0,0,0,0,0,0,1,0
05-028,4,1,8,0,0,0,0,0,0,1,1
06-033,4,1,7,0,0,0,0,0,0,1,0
09-006,3,1,8,0,0,0,0,0,0,0,1
06-017,5,1,6,0,0,0,0,0,1,0,0
06-009,4,1,1,1,0,0,0,0,0,0,1
04-041,6,1,5,0,1,0,0,0,1,1,1
03-028,4,1,8,1,0,0,0,0,0,0,1
06-032,2,1,1,1,0,0,0,0,0,0,0
02-012,5,1,7,0,0,0,0,0,0,1,0
05-014,2,1,5,1,1,0,0,0,1,0,0
07-005,2,1,7,0,0,0,0,0,0,1,0
09-050,2,1,8,0,0,0,0,0,0,0,1
09-011,5,1,4,1,1,0,1,0,0,1,1
;&lt;/PRE&gt;
&lt;P&gt;So to read you data the INFILE statement would have the path and file name in quotes:&lt;/P&gt;
&lt;P&gt;Infile "c:\folder\subfolder\sampledata.csv" dlm=',';&lt;/P&gt;
&lt;P&gt;and you would not include the DATALINES portion.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Apr 2021 17:07:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/variable-name-with-special-character-how-to-convert-as-SAS/m-p/733849#M228670</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-04-14T17:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: variable name with special character how to convert as SAS Standard variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/variable-name-with-special-character-how-to-convert-as-SAS/m-p/733852#M228672</link>
      <description>&lt;P&gt;Since it is a text file just use your own names when reading the data.&lt;/P&gt;
&lt;P&gt;They don't have to be anything like the column headers.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  infile "Sample_data.csv" dsd truncover firstobs=2;
  input id $ var1-var11;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can also make sure to set VALIDVARNAME=V7 and then let PROC IMPORT try to convert the headers into valid names.&amp;nbsp; But then you lose control over not only how the variables are named but also how they are defined.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Apr 2021 17:18:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/variable-name-with-special-character-how-to-convert-as-SAS/m-p/733852#M228672</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-04-14T17:18:32Z</dc:date>
    </item>
  </channel>
</rss>

