<?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: how to specify some variable format during a proc import data csv file in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-specify-some-variable-format-during-a-proc-import-data/m-p/938255#M45115</link>
    <description>&lt;P&gt;If you know the variables do NOT use PROC IMPORT.&amp;nbsp; That is a tool for GUESSING how to read a CSV file.&amp;nbsp; When you know what is in the file just READ it instead.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have no idea what is in the files then you could use PROC IMPORT to get a rough idea.&amp;nbsp; Then copy the code it generates and adapt it and rerun it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you do use PROC IMPORT then make sure to add the GUESSINGROWS=MAX statement so it does not make the decisions on what types of variables to create without looking at all of the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could also just use a different tool to make the GUESSes about how to read the CSV file.&amp;nbsp; Such as this one:&amp;nbsp;&amp;nbsp;&lt;A href="https://github.com/sasutils/macros/blob/master/csv2ds.sas" target="_blank" rel="noopener"&gt;https://github.com/sasutils/macros/blob/master/csv2ds.sas&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Which does include a method for you to override its decisions about how to read the variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that FORMAT has a special meaning in SAS that is different from the way you used it. In SAS a format is instructions for how to display the values.&amp;nbsp; You are asking about how to change the TYPE that PROC IMPORT defines for the the variable, not the format attached to it.&amp;nbsp; Changing the format attached to a variable after it is already created is easy.&amp;nbsp; But changing the type is harder (and might not work since reading a string as a number loses some of the information).&lt;/P&gt;</description>
    <pubDate>Mon, 05 Aug 2024 17:34:40 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2024-08-05T17:34:40Z</dc:date>
    <item>
      <title>how to specify some variable format during a proc import data csv file</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-specify-some-variable-format-during-a-proc-import-data/m-p/938252#M45114</link>
      <description>&lt;P&gt;Good Afternoon,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to specify / modify a variable format with loosing information during a proc import.&lt;/P&gt;
&lt;P&gt;One of the variable is map as a numerical variable while it should stay as a string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let csvinputpath=/path1/data;
 
Filename mrcsvfil pipe "ls -Art &amp;amp;csvinputpath./*.csv | tail -n 1 ";
 
DATA folderinfo;
Infile mrcsvfil truncover;&lt;BR /&gt;
Input 	infile_name $100.;
Filename=scan(infile_name,-1,"/","b");
call symput ('csvFile',strip(Filename));
call symput ('cn_csvFile1',strip(infile_name));
RUN;

libname dest1 "path2/temp/";

options validvarname=v7;
PROC IMPORT OUT=dest1.dataretentionpolicieslist
    DATAFILE="&amp;amp;csvinputpath/&amp;amp;csvFile."
    DBMS=CSV
    REPLACE;
	delimiter='|';
    getnames=yes;
    	
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2024 17:13:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-specify-some-variable-format-during-a-proc-import-data/m-p/938252#M45114</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2024-08-05T17:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: how to specify some variable format during a proc import data csv file</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-specify-some-variable-format-during-a-proc-import-data/m-p/938255#M45115</link>
      <description>&lt;P&gt;If you know the variables do NOT use PROC IMPORT.&amp;nbsp; That is a tool for GUESSING how to read a CSV file.&amp;nbsp; When you know what is in the file just READ it instead.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have no idea what is in the files then you could use PROC IMPORT to get a rough idea.&amp;nbsp; Then copy the code it generates and adapt it and rerun it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you do use PROC IMPORT then make sure to add the GUESSINGROWS=MAX statement so it does not make the decisions on what types of variables to create without looking at all of the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could also just use a different tool to make the GUESSes about how to read the CSV file.&amp;nbsp; Such as this one:&amp;nbsp;&amp;nbsp;&lt;A href="https://github.com/sasutils/macros/blob/master/csv2ds.sas" target="_blank" rel="noopener"&gt;https://github.com/sasutils/macros/blob/master/csv2ds.sas&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Which does include a method for you to override its decisions about how to read the variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that FORMAT has a special meaning in SAS that is different from the way you used it. In SAS a format is instructions for how to display the values.&amp;nbsp; You are asking about how to change the TYPE that PROC IMPORT defines for the the variable, not the format attached to it.&amp;nbsp; Changing the format attached to a variable after it is already created is easy.&amp;nbsp; But changing the type is harder (and might not work since reading a string as a number loses some of the information).&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2024 17:34:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-specify-some-variable-format-during-a-proc-import-data/m-p/938255#M45115</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-08-05T17:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: how to specify some variable format during a proc import data csv file</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-specify-some-variable-format-during-a-proc-import-data/m-p/938280#M45116</link>
      <description>I have tried the tool import data in SAS EG and I am getting this error: &lt;BR /&gt;&lt;BR /&gt;Une exception de type 'System.OutOfMemoryException' a été levée.</description>
      <pubDate>Mon, 05 Aug 2024 18:39:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-specify-some-variable-format-during-a-proc-import-data/m-p/938280#M45116</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2024-08-05T18:39:56Z</dc:date>
    </item>
    <item>
      <title>Re: how to specify some variable format during a proc import data csv file</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-specify-some-variable-format-during-a-proc-import-data/m-p/938294#M45117</link>
      <description>&lt;P&gt;Sounds like the Enterprise Guide tool is trying to analyze the file and having trouble.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Personally I would just use the copy file task in EG to move the CSV file to the SAS server (not needed if you are connecting EG to PC SAS running on the same PC as EG) and then just use SAS to read the CSV file.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2024 20:11:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/how-to-specify-some-variable-format-during-a-proc-import-data/m-p/938294#M45117</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-08-05T20:11:49Z</dc:date>
    </item>
  </channel>
</rss>

