<?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: Cannot transform imported char variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Cannot-transform-imported-char-variable/m-p/331827#M74638</link>
    <description>&lt;P&gt;Not sure what your problem is since your code does work for me. However, that said, here is a work around the should work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc import datafile="c:\art\RealGDP2001-20016_Bulgaria.csv"
out=GDP_Bulgaria dbms=csv replace; 
getnames=no;
datarow=6;
run;

data GDP_Bulgaria;
  set GDP_Bulgaria (rename=(var2=GDP));
  date = input(var1, YYQ6.);
  format date yyq.;
  drop var1;
run;
&lt;/PRE&gt;
&lt;P&gt;HTH,&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 11 Feb 2017 15:43:53 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2017-02-11T15:43:53Z</dc:date>
    <item>
      <title>Cannot transform imported char variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-transform-imported-char-variable/m-p/331808#M74626</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am importing a csv file. After dropping the first lines with the metadata I am trying to transform the two columns into date and numeric formats respectively:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc import datafile="/path/RealGDP2001-20016_Bulgaria.csv"
out=GDP_Bulgaria dbms=csv replace; 
getnames=no; 
run;

data GDP_Bulgaria; set GDP_Bulgaria; 
	if _n_&amp;gt;5; 
run;
                                                             

data GDP_Bulgaria; set GDP_Bulgaria; 
	date = input(var1, YYQ6.);
	format date yyq.;
	GDP = input(var2,8.);
	drop var1;
run;&lt;/PRE&gt;&lt;P&gt;No problems with the date, however for the numeric variable nothing seems to work. I tried compress(), trim(), strip() and vvalue() transformations before attempting to convert without success.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem seems to be related with the fact that some values have minus and other dont. If I change the variable length to 4 then those with minus are converted but the others aren't regardless if I am using compress or not.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Feb 2017 13:36:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-transform-imported-char-variable/m-p/331808#M74626</guid>
      <dc:creator>KonstantinV</dc:creator>
      <dc:date>2017-02-11T13:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot transform imported char variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-transform-imported-char-variable/m-p/331813#M74631</link>
      <description>&lt;P&gt;Change GDP informat:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;GDP = input(var2,best8.1);  &lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Feb 2017 14:04:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-transform-imported-char-variable/m-p/331813#M74631</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-02-11T14:04:54Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot transform imported char variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-transform-imported-char-variable/m-p/331821#M74636</link>
      <description>&lt;P&gt;I just tried but it doesn't work.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Feb 2017 14:37:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-transform-imported-char-variable/m-p/331821#M74636</guid>
      <dc:creator>KonstantinV</dc:creator>
      <dc:date>2017-02-11T14:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot transform imported char variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-transform-imported-char-variable/m-p/331822#M74637</link>
      <description>&lt;P&gt;Your results are consistent with VAR2 being numeric originally. &amp;nbsp;All you would need to do is rename it to GDP.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Feb 2017 15:03:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-transform-imported-char-variable/m-p/331822#M74637</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-02-11T15:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot transform imported char variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-transform-imported-char-variable/m-p/331827#M74638</link>
      <description>&lt;P&gt;Not sure what your problem is since your code does work for me. However, that said, here is a work around the should work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc import datafile="c:\art\RealGDP2001-20016_Bulgaria.csv"
out=GDP_Bulgaria dbms=csv replace; 
getnames=no;
datarow=6;
run;

data GDP_Bulgaria;
  set GDP_Bulgaria (rename=(var2=GDP));
  date = input(var1, YYQ6.);
  format date yyq.;
  drop var1;
run;
&lt;/PRE&gt;
&lt;P&gt;HTH,&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Feb 2017 15:43:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-transform-imported-char-variable/m-p/331827#M74638</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-02-11T15:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot transform imported char variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Cannot-transform-imported-char-variable/m-p/331890#M74663</link>
      <description>&lt;P&gt;Don't use PROC IMPORT to read a CSV file with only two columns. It will take less code to write the DATA step, plus you get to have complete control over the variable names and types.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  infile cards dsd firstobs=6 truncover;
  length Date GDP 8 ;
  informat date yyq. ;
  format date yyq6. ;
  input Date GDP ;
cards4;
Data Source in SDW: http://sdw.ecb.europa.eu/quickview.do?SERIES_KEY=320.MNA.Q.Y.BG.W2.S1.S1.B.B1GQ._Z._Z._Z.XDC.LR.GY
,MNA.Q.Y.BG.W2.S1.S1.B.B1GQ._Z._Z._Z.XDC.LR.GY
",""Gross domestic product at market prices - Bulgaria - Domestic (home or reference area), Total economy, Domestic currency (incl. conversion to current currency made using a fix parity), Chain linked volume (rebased), Growth rate, over 1 year, Calendar a
Collection:,Summed through period (S)
Period\Unit:,
2016Q3,3.4
2016Q2,3.6
2016Q1,3.4
2015Q4,3.7
;;;;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 11 Feb 2017 23:42:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Cannot-transform-imported-char-variable/m-p/331890#M74663</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-02-11T23:42:11Z</dc:date>
    </item>
  </channel>
</rss>

