<?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: Importing SPSS (.sav) data, problem with varchar data type in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Importing-SPSS-sav-data-problem-with-varchar-data-type/m-p/550568#M16900</link>
    <description>&lt;P&gt;cheers for the response. The issue is about getting a clean import, that's all i'm concerned with, and i still don't have that. Yes, it's easy to assign formats etc post hoc, but it doesn't help me produce a clean log for documentation, that would be ideal. The example i gave in proc contents is not relevant actually, it's not one of the variables that's causing a problem, that was just a red herring, a distraction (in response to a previous usre's question) and it's not the main issue&lt;/P&gt;</description>
    <pubDate>Fri, 12 Apr 2019 10:52:35 GMT</pubDate>
    <dc:creator>pau13rown</dc:creator>
    <dc:date>2019-04-12T10:52:35Z</dc:date>
    <item>
      <title>Importing SPSS (.sav) data, problem with varchar data type</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Importing-SPSS-sav-data-problem-with-varchar-data-type/m-p/549814#M16873</link>
      <description>&lt;P&gt;I have read what I can find on this topic but it doesn't address my particular issue&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my code is as follows:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options MSGLEVEL=I;
proc import 
  out=raw.data
  datafile="....\data\spss\xxxxxxxx.sav" 
  dbms=spss replace ;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;i get the following message in the log:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;NOTE: VARCHAR data type is not supported by the V9 engine.
Variable xxxxx has been converted to CHAR data type. 

NOTE: Table has been opened in browse mode. 
ERROR: Asterisks are an indication of a format width problem. 
ERROR: Asterisks are an indication of a format width problem. 
ERROR: Asterisks are an indication of a format width problem. 
ERROR: Asterisks are an indication of a format width problem. 

etc&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i've tried a number of ways to get around this, eg adding a format statement within proc import, but nothing resolves it. One of the affected variables is a key variable and thus I can't simply discard the subset of affected variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;any suggestions? cheers&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2019 22:07:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Importing-SPSS-sav-data-problem-with-varchar-data-type/m-p/549814#M16873</guid>
      <dc:creator>pau13rown</dc:creator>
      <dc:date>2019-04-09T22:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: Importing SPSS (.sav) data, problem with varchar data type</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Importing-SPSS-sav-data-problem-with-varchar-data-type/m-p/549819#M16874</link>
      <description>&lt;P&gt;Instead of opening the table what happens if you use Proc Print on the data set?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The * for to short values is not an indication of bad data, just that the variable won't fit in the allowed display.&lt;/P&gt;
&lt;P&gt;Example the log will show a single * for this and anot.&lt;/P&gt;
&lt;PRE&gt;data _null_;
   x=12345678;
   put x f1.;
run;&lt;/PRE&gt;
&lt;P&gt;This tends to be more of numeric variable problem though.&lt;/P&gt;
&lt;P&gt;If the format is too short for a character value then only what will fit is displayed:&lt;/P&gt;
&lt;PRE&gt;data _null_;
   x='abcdefghi';
   put x $2.;
run;&lt;/PRE&gt;
&lt;P&gt;I would suggest running proc contents on your data set and see which variables may have a numeric format shorter than you might expect. Change them or use a longer format with proc print to verify the values.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2019 23:01:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Importing-SPSS-sav-data-problem-with-varchar-data-type/m-p/549819#M16874</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-04-09T23:01:31Z</dc:date>
    </item>
    <item>
      <title>Re: Importing SPSS (.sav) data, problem with varchar data type</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Importing-SPSS-sav-data-problem-with-varchar-data-type/m-p/550021#M16876</link>
      <description>&lt;P&gt;thanks for the reply, but I think the issue is with the varchar format. The data are converted to "*" and the variable is not that long, maybe 12 characters. If i view the data, using print print or whatever, it appears as "*".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What can i do to resolve this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;edit: to try to get a sense of the format issue i did this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import 
  out=xxxxxx
  datafile=".....\xxxxxxx.sav" 
  dbms=spss replace ;
fmtlib = WORK.FORMATS;
run;

proc format lib=work;
 select [variable of interest];
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;but it doesn't reveal to me the format. It only says&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;NOTE: PROCEDURE FORMAT used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds

NOTE: No formats found that match SELECT statement.
NOTE: At least one W.D format was too small for the number to be printed. The decimal may be
      shifted by the "BEST" format.&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Apr 2019 18:05:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Importing-SPSS-sav-data-problem-with-varchar-data-type/m-p/550021#M16876</guid>
      <dc:creator>pau13rown</dc:creator>
      <dc:date>2019-04-10T18:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: Importing SPSS (.sav) data, problem with varchar data type</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Importing-SPSS-sav-data-problem-with-varchar-data-type/m-p/550026#M16877</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/183379"&gt;@pau13rown&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;thanks for the reply, but I think the issue is with the varchar format. The data are converted to "*" and the variable is not that long, maybe 12 characters. If i view the data, using print print or whatever, it appears as "*".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What can i do to resolve this?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Can you show the results of PROC Contents for that data set? And indicate which variables are "varchar" that are showing the behavior you mention?&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>Wed, 10 Apr 2019 18:03:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Importing-SPSS-sav-data-problem-with-varchar-data-type/m-p/550026#M16877</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-04-10T18:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: Importing SPSS (.sav) data, problem with varchar data type</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Importing-SPSS-sav-data-problem-with-varchar-data-type/m-p/550028#M16878</link>
      <description>&lt;P&gt;good point. I ran proc contents and it shows the following for the affected variable:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; #    Variable                    Type    Len    Format    Informat    Label

 1    xxxxxxx                     Num       8     F1.                  xxxxxxx&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thus, i did the following and now the data are revealed to me (ie the issue is resolved):&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
format a $50.;
set [dataset with the issue];
a=xxxxxxxx;
keep a;
run;

proc print data=a (obs=500);
  var a;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;i guess i can now proceed, but it's a bit disconcerting because i don't really understand all the kerfuffle....&lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2019 18:19:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Importing-SPSS-sav-data-problem-with-varchar-data-type/m-p/550028#M16878</guid>
      <dc:creator>pau13rown</dc:creator>
      <dc:date>2019-04-10T18:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: Importing SPSS (.sav) data, problem with varchar data type</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Importing-SPSS-sav-data-problem-with-varchar-data-type/m-p/550457#M16890</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/183379"&gt;@pau13rown&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now that you've shared the Proc Contents result with us it looks like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. The Varchar to Char conversion is not the problem. This is about Data Types and not Formats AND the resulting variables will be of type Char and not Num.&lt;/P&gt;
&lt;P&gt;2. The format applied on the variable you show us is F1. - which is only appropriate for a single digit. I'd assume the actual values stored in this variable are bigger and though as the Warning tells you SAS will print them as XXXXX.&lt;/P&gt;
&lt;P&gt;But this is only about Printing and not what SAS stores internally. What you need to do is print this variable with a suitable Format. Try something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=&amp;lt;your table&amp;gt;;
  var xxxxxxx;
  format xxxxxxx best32.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 22:46:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Importing-SPSS-sav-data-problem-with-varchar-data-type/m-p/550457#M16890</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-04-11T22:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: Importing SPSS (.sav) data, problem with varchar data type</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Importing-SPSS-sav-data-problem-with-varchar-data-type/m-p/550480#M16892</link>
      <description>&lt;P&gt;The VARCHAR warning from PROC IMPORT is caused by some change inside of SAS. We never used to see that message and now with SAS 9.4M5 I am seeing it a lot.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect that whatever code that PROC IMPORT is running is using the new VARCHAR data type that PROC DS2 supports, but it can't keep that type when it writes the results to an actual SAS dataset since those only support two data types, fixed length character strings and floating point numbers. Why it bothers to write the message I don't know.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 00:20:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Importing-SPSS-sav-data-problem-with-varchar-data-type/m-p/550480#M16892</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-04-12T00:20:43Z</dc:date>
    </item>
    <item>
      <title>Re: Importing SPSS (.sav) data, problem with varchar data type</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Importing-SPSS-sav-data-problem-with-varchar-data-type/m-p/550568#M16900</link>
      <description>&lt;P&gt;cheers for the response. The issue is about getting a clean import, that's all i'm concerned with, and i still don't have that. Yes, it's easy to assign formats etc post hoc, but it doesn't help me produce a clean log for documentation, that would be ideal. The example i gave in proc contents is not relevant actually, it's not one of the variables that's causing a problem, that was just a red herring, a distraction (in response to a previous usre's question) and it's not the main issue&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 10:52:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Importing-SPSS-sav-data-problem-with-varchar-data-type/m-p/550568#M16900</guid>
      <dc:creator>pau13rown</dc:creator>
      <dc:date>2019-04-12T10:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: Importing SPSS (.sav) data, problem with varchar data type</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Importing-SPSS-sav-data-problem-with-varchar-data-type/m-p/550573#M16901</link>
      <description>&lt;P&gt;ok i just live with it, and document it as an innocuous and superfluous note in the log&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 10:54:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Importing-SPSS-sav-data-problem-with-varchar-data-type/m-p/550573#M16901</guid>
      <dc:creator>pau13rown</dc:creator>
      <dc:date>2019-04-12T10:54:50Z</dc:date>
    </item>
  </channel>
</rss>

