<?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: dealing with unknown characters in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/dealing-with-unknown-characters/m-p/731748#M80374</link>
    <description>&lt;P&gt;try this code.&lt;/P&gt;
&lt;P&gt;It's not perfect, but I think it will be possible to proc freq with categorical variables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename imp "/folders/myfolders/sasuser.v94/WFP/datasets/EMNV14-02 DATOS DE LA VIVIENDA Y EL HOGAR (1).SAV" encoding='utf-8';
proc import datafile = imp
  out= work.nicaragua
  dbms=sav
  replace;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 06 Apr 2021 23:23:26 GMT</pubDate>
    <dc:creator>japelin</dc:creator>
    <dc:date>2021-04-06T23:23:26Z</dc:date>
    <item>
      <title>dealing with unknown characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/dealing-with-unknown-characters/m-p/731705#M80373</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am a new sas user trying to clean up a dataset. I am interested in coding some categorical variables into a composite variable of water and sanitation quality.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset from nicaragua where responses have accents. It was a previous SPSS file, and when I import to SAS all accent characters convert to unknown characters and prevent me from running a proc freq. I simply need 9 categories to code as 0/1, so the variable could simply be converted to numeric if I know what the values mean. Can someone please advise on how to get rid of the unknown character? The variable in question is S1P15&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dataset is attached. Current proc import below:&amp;nbsp;&lt;/P&gt;&lt;P&gt;*import spss dataset and convert;&lt;BR /&gt;proc import datafile = "/folders/myfolders/sasuser.v94/WFP/datasets/EMNV14-02 DATOS DE LA VIVIENDA Y EL HOGAR (1).SAV"&lt;BR /&gt;out= work.nicaragua&lt;BR /&gt;dbms=sav&lt;BR /&gt;replace;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Apr 2021 20:27:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/dealing-with-unknown-characters/m-p/731705#M80373</guid>
      <dc:creator>rhaley1821</dc:creator>
      <dc:date>2021-04-06T20:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: dealing with unknown characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/dealing-with-unknown-characters/m-p/731748#M80374</link>
      <description>&lt;P&gt;try this code.&lt;/P&gt;
&lt;P&gt;It's not perfect, but I think it will be possible to proc freq with categorical variables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename imp "/folders/myfolders/sasuser.v94/WFP/datasets/EMNV14-02 DATOS DE LA VIVIENDA Y EL HOGAR (1).SAV" encoding='utf-8';
proc import datafile = imp
  out= work.nicaragua
  dbms=sav
  replace;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Apr 2021 23:23:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/dealing-with-unknown-characters/m-p/731748#M80374</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2021-04-06T23:23:26Z</dc:date>
    </item>
    <item>
      <title>Re: dealing with unknown characters</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/dealing-with-unknown-characters/m-p/731814#M80375</link>
      <description>&lt;P&gt;Your example dataset only has numeric variables.&amp;nbsp; So the dataset should work fine.&lt;/P&gt;
&lt;P&gt;But the formats might be generated using the original encoding instead of the encoding of your SAS session.&lt;/P&gt;
&lt;P&gt;Here is method to convert the format text from WLATIN1 to UTF-8.&lt;/P&gt;
&lt;P&gt;First import the SAV file and tell it to build the format catalog.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import datafile = "c:\downloads\spss.sav"
  dbms=sav
  out= work.nicaragua replace
;
  fmtlib=work.nicaragua;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then convert the format catalog to a dataset.&amp;nbsp; And change the values of the LABEL variable from WLATIN1 to UTF-8 encoding.&amp;nbsp; Get rid of the MIN/MAX/DEFAULT/LENGTH variables so that PROC FORMAT will recalculate the default length to use based on the adjusted label values.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format lib=work.nicaragua out=formats; run;
data formats;
  length label $200;
  set formats ;
  label=kcvt(label,'wlatin1','utf-8');
  keep fmtname start end label;
run;
proc format lib=work.nicaragua cntlin=formats ; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now let's try using the labels. If you didn't write the formats into the WORK.FORMATS catalog then make sure to add the catalog to the FMTSEARCH option.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options insert=(fmtsearch=(work.nicaragua));
proc freq data=nicaragua;
 tables S1P25 ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 591px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/57032iEE00ABE3FB3930EB/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 06:23:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/dealing-with-unknown-characters/m-p/731814#M80375</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-04-07T06:23:35Z</dc:date>
    </item>
  </channel>
</rss>

