<?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 How to Determine File Structure of .BCP file Using SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-Determine-File-Structure-of-BCP-file-Using-SAS/m-p/813066#M320829</link>
    <description>&lt;P&gt;&lt;SPAN&gt;I have 2 .BCP files I am trying to import into SAS. I used proc import, but the date variables changed format. I would like to figure out the length of each variable so I can import using inline. Is there a way to determine the lengths of the variables in the .BCP file?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 12 May 2022 18:37:02 GMT</pubDate>
    <dc:creator>smg3141</dc:creator>
    <dc:date>2022-05-12T18:37:02Z</dc:date>
    <item>
      <title>How to Determine File Structure of .BCP file Using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Determine-File-Structure-of-BCP-file-Using-SAS/m-p/813066#M320829</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I have 2 .BCP files I am trying to import into SAS. I used proc import, but the date variables changed format. I would like to figure out the length of each variable so I can import using inline. Is there a way to determine the lengths of the variables in the .BCP file?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 May 2022 18:37:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Determine-File-Structure-of-BCP-file-Using-SAS/m-p/813066#M320829</guid>
      <dc:creator>smg3141</dc:creator>
      <dc:date>2022-05-12T18:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to Determine File Structure of .BCP file Using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Determine-File-Structure-of-BCP-file-Using-SAS/m-p/813123#M320858</link>
      <description>&lt;P&gt;PROC IMPORT cannot determine the length.&lt;/P&gt;
&lt;P&gt;Access dictionary table to figure out the length of variables after import.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;For example.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set sashelp.vcolumn;
  where LIBNAME="SASHELP" and MEMNAME="CLASS";
  put libname memname name length;
run;

proc sql;
   select libname, memname, name, length  
   from DICTIONARY.COLUMNS
   where LIBNAME="SASHELP" and MEMNAME="CLASS";
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 May 2022 04:22:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Determine-File-Structure-of-BCP-file-Using-SAS/m-p/813123#M320858</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2022-05-13T04:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to Determine File Structure of .BCP file Using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Determine-File-Structure-of-BCP-file-Using-SAS/m-p/813133#M320862</link>
      <description>&lt;P&gt;BCP? Never heard of it. Please explain.&lt;/P&gt;
&lt;P&gt;If those files are text-files, you must have documentation of the structure, if not ask for one. Guessing types, lengths and informats is the best way to create more work in the long-run.&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2022 06:02:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Determine-File-Structure-of-BCP-file-Using-SAS/m-p/813133#M320862</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-05-13T06:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to Determine File Structure of .BCP file Using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Determine-File-Structure-of-BCP-file-Using-SAS/m-p/813153#M320872</link>
      <description>&lt;P&gt;From the Microsoft documentation&amp;nbsp;&lt;A href="https://docs.microsoft.com/en-us/sql/tools/bcp-utility?view=sql-server-ver15" target="_blank"&gt;https://docs.microsoft.com/en-us/sql/tools/bcp-utility?view=sql-server-ver15&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1652434553905.png" style="width: 686px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/71413i976E040CBFA4E2D9/image-dimensions/686x108?v=v2" width="686" height="108" role="button" title="Patrick_0-1652434553905.png" alt="Patrick_0-1652434553905.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;So I guess you would eventually want the format file as well. But then because you're not importing into a SQL server you would then also need to write a program that maps the SQL server data types and attributes to the appropriate SAS data types and attributes (like the right informat for any date and datetime values).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ideally connect directly to the SQL server and export the data this way. Or then try to get the data as JSON files and not as .bcp&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2022 09:40:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Determine-File-Structure-of-BCP-file-Using-SAS/m-p/813153#M320872</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-05-13T09:40:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to Determine File Structure of .BCP file Using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-Determine-File-Structure-of-BCP-file-Using-SAS/m-p/813241#M320911</link>
      <description>&lt;P&gt;It really depends on what is in those files.&lt;/P&gt;
&lt;P&gt;From the documentation page linked by an earlier reply you might be lucky and they are just simple tab delimited files.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;-c&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Performs the operation using a character data type. This option does not prompt for each field; it uses&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;char&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;as the storage type, without prefixes and with&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;\t&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;(tab character) as the field separator and&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;\r\n&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;(newline character) as the row terminator.&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;-c&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;is not compatible with&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;-w&lt;/STRONG&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;LOOK at the file and see what you have.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Check to see if they are text files with lines by looking at the first 5 lines.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename BCP 'myfilename.bcp';
data _null_;
  infile bcp obs=5;
  input;
  list;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;Or look at them a binary files.&amp;nbsp; To check the first 500 bytes you could use:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  infile bcp recfm=f lrecl=100 obs=5;
  input;
  list;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2022 15:13:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-Determine-File-Structure-of-BCP-file-Using-SAS/m-p/813241#M320911</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-05-13T15:13:49Z</dc:date>
    </item>
  </channel>
</rss>

