<?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 filter variable from SPSS file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/filter-variable-from-SPSS-file/m-p/705993#M216644</link>
    <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I imported an SPSS file using PROC IMPORT. The import ran smoothly.&lt;/P&gt;&lt;P&gt;One of the variables in the dataset was a filter variable in SPSS, and SAS kept its name:&amp;nbsp;FILTER_$.&lt;/P&gt;&lt;P&gt;This variables has values &lt;STRONG&gt;Selected&lt;/STRONG&gt; or &lt;STRONG&gt;Non Selected, &lt;/STRONG&gt;and SAS tells me its TYPE is numeric (which is strange) and that its FORMAT is &lt;STRONG&gt;FILTER_A&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;See attached PDF with two pages that contain snapshots of the SAS file and the variable info.&lt;/P&gt;&lt;P&gt;SAS does not recognize the variable name FORMAT_$ when i try to use it, and if I try to RENAME it, I get the error message detailed in page 3 of the attached PDF file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea of why it doest not recognize the variable name?&amp;nbsp; My guess is that it has to do with the fact that it is considered a filter variable by SAS (hence the format that it gives it), but when I do a PROC FREQ without specifying any variable, it gives me a table for that variable, too!&amp;nbsp; I simply cannot use its name - it's like&amp;nbsp;Voldemort!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestion?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Eman&lt;/P&gt;</description>
    <pubDate>Tue, 15 Dec 2020 12:04:23 GMT</pubDate>
    <dc:creator>emaneman</dc:creator>
    <dc:date>2020-12-15T12:04:23Z</dc:date>
    <item>
      <title>filter variable from SPSS file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filter-variable-from-SPSS-file/m-p/705993#M216644</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I imported an SPSS file using PROC IMPORT. The import ran smoothly.&lt;/P&gt;&lt;P&gt;One of the variables in the dataset was a filter variable in SPSS, and SAS kept its name:&amp;nbsp;FILTER_$.&lt;/P&gt;&lt;P&gt;This variables has values &lt;STRONG&gt;Selected&lt;/STRONG&gt; or &lt;STRONG&gt;Non Selected, &lt;/STRONG&gt;and SAS tells me its TYPE is numeric (which is strange) and that its FORMAT is &lt;STRONG&gt;FILTER_A&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;See attached PDF with two pages that contain snapshots of the SAS file and the variable info.&lt;/P&gt;&lt;P&gt;SAS does not recognize the variable name FORMAT_$ when i try to use it, and if I try to RENAME it, I get the error message detailed in page 3 of the attached PDF file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea of why it doest not recognize the variable name?&amp;nbsp; My guess is that it has to do with the fact that it is considered a filter variable by SAS (hence the format that it gives it), but when I do a PROC FREQ without specifying any variable, it gives me a table for that variable, too!&amp;nbsp; I simply cannot use its name - it's like&amp;nbsp;Voldemort!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestion?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Eman&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 12:04:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filter-variable-from-SPSS-file/m-p/705993#M216644</guid>
      <dc:creator>emaneman</dc:creator>
      <dc:date>2020-12-15T12:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: filter variable from SPSS file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filter-variable-from-SPSS-file/m-p/706010#M216652</link>
      <description>&lt;P&gt;If the variable name contains "illegal" characters, or begins with a number, you can refer to it in programs like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;'FILTER_$'n&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;- just put the name in quotes and put an "n" afterwards.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not familiar with SPSS output and filter variables, but it looks like it is a logical value, which is 1 or 0 in SAS. So my guess is that the format shows "Selected" when the value is 1, and "Not selected" when it is 0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can see the numeric values by using another format in e.g. PROC PRINT:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=&amp;lt;SPSS_Import&amp;gt;(obs=20);
  format 'FILTER_$'n best32.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Dec 2020 13:01:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filter-variable-from-SPSS-file/m-p/706010#M216652</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2020-12-15T13:01:14Z</dc:date>
    </item>
    <item>
      <title>Re: filter variable from SPSS file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filter-variable-from-SPSS-file/m-p/706011#M216653</link>
      <description>&lt;P&gt;To use such variable names in SAS, you need to have&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options validvarname=any;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;set and use a "name literal":&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;'FILTER_$'n&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Your variable is most probably a boolean type in SPSS, with a proper format attached to translate the two possible numeric values (1 or 0) to the strings you see. AFAIK, the SPSS import should create that format, but you may have to set the FMTSEARCH option.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 13:03:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filter-variable-from-SPSS-file/m-p/706011#M216653</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-12-15T13:03:11Z</dc:date>
    </item>
    <item>
      <title>Re: filter variable from SPSS file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filter-variable-from-SPSS-file/m-p/706013#M216654</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I renamed the variable by adding:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;rename 'FILTER_$'n=filter;&lt;/P&gt;&lt;P&gt;and now the new variable called simply filter, which can be then used.&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;PRE&gt;&lt;CODE&gt;'FILTER_$'n&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Dec 2020 13:09:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filter-variable-from-SPSS-file/m-p/706013#M216654</guid>
      <dc:creator>emaneman</dc:creator>
      <dc:date>2020-12-15T13:09:07Z</dc:date>
    </item>
  </channel>
</rss>

