<?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: Truncation of character variables to 8 when import csv file from website in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Truncation-of-character-variables-to-8-when-import-csv-file-from/m-p/922954#M363386</link>
    <description>&lt;P&gt;All new variables created by the INPUT statement will have a length of 8 by default. Use informats on the INPUT statement to override the default and set the length values you need:&lt;/P&gt;
&lt;PRE&gt;filename tempurl TEMP;

proc http
   url= "https://s3.amazonaws.com/talent-assets.datacamp.com/product_sales.csv"
	method="get" out=tempurl;
run;


/* Import the data from the URL into a SAS dataset */
options errors=0; /* Suppress invalid data log entries whe REVENUE values are "NA" */
data work.sales;
	infile tempurl dlm =',' dsd firstobs=2 truncover ; /* Set delimiter and skip header row */
	/* Supplay informats on the input statement to set variable lengths */
	input week:best32.  sales_method:$12.  customer_id:$36.  nb_sold:best32. revenue:best32. 
	years_as_customer:best32.  nb_site_visits:best32.  state:$13.  ;
run;&lt;BR /&gt;options errors=20; /* Restore default setting */&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 04 Apr 2024 12:52:48 GMT</pubDate>
    <dc:creator>SASJedi</dc:creator>
    <dc:date>2024-04-04T12:52:48Z</dc:date>
    <item>
      <title>Truncation of character variables to 8 when import csv file from website</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Truncation-of-character-variables-to-8-when-import-csv-file-from/m-p/922683#M363327</link>
      <description>&lt;P&gt;Truncation of character variables to 8 when import csv file from website using code as follow. If I set 'sales_method' $12. then it read some characters from the next column. Please help me. Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;filename tempurl TEMP;&lt;/P&gt;&lt;P&gt;proc http&lt;BR /&gt;url= "&lt;A href="https://s3.amazonaws.com/talent-assets.datacamp.com/product_sales.csv" target="_blank"&gt;https://s3.amazonaws.com/talent-assets.datacamp.com/product_sales.csv&lt;/A&gt;"&lt;BR /&gt;method="get"&lt;BR /&gt;out=tempurl ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* Import the data from the URL into a SAS dataset */&lt;BR /&gt;data work.sales;&lt;BR /&gt;infile tempurl dlm =',' dsd firstobs=2 truncover ; /* Set delimiter and skip header row */&lt;BR /&gt;input week $ sales_method $ customer_id $ nd_sold revenue&lt;BR /&gt;years_as_customer nb_site_visits state $ ;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2024 09:00:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Truncation-of-character-variables-to-8-when-import-csv-file-from/m-p/922683#M363327</guid>
      <dc:creator>nnthieu</dc:creator>
      <dc:date>2024-04-03T09:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: Truncation of character variables to 8 when import csv file from website</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Truncation-of-character-variables-to-8-when-import-csv-file-from/m-p/922954#M363386</link>
      <description>&lt;P&gt;All new variables created by the INPUT statement will have a length of 8 by default. Use informats on the INPUT statement to override the default and set the length values you need:&lt;/P&gt;
&lt;PRE&gt;filename tempurl TEMP;

proc http
   url= "https://s3.amazonaws.com/talent-assets.datacamp.com/product_sales.csv"
	method="get" out=tempurl;
run;


/* Import the data from the URL into a SAS dataset */
options errors=0; /* Suppress invalid data log entries whe REVENUE values are "NA" */
data work.sales;
	infile tempurl dlm =',' dsd firstobs=2 truncover ; /* Set delimiter and skip header row */
	/* Supplay informats on the input statement to set variable lengths */
	input week:best32.  sales_method:$12.  customer_id:$36.  nb_sold:best32. revenue:best32. 
	years_as_customer:best32.  nb_site_visits:best32.  state:$13.  ;
run;&lt;BR /&gt;options errors=20; /* Restore default setting */&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Apr 2024 12:52:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Truncation-of-character-variables-to-8-when-import-csv-file-from/m-p/922954#M363386</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2024-04-04T12:52:48Z</dc:date>
    </item>
    <item>
      <title>Re: Truncation of character variables to 8 when import csv file from website</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Truncation-of-character-variables-to-8-when-import-csv-file-from/m-p/923060#M363422</link>
      <description>&lt;P&gt;It works. Excellent !. Thank you so much.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2024 22:58:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Truncation-of-character-variables-to-8-when-import-csv-file-from/m-p/923060#M363422</guid>
      <dc:creator>nnthieu</dc:creator>
      <dc:date>2024-04-04T22:58:52Z</dc:date>
    </item>
  </channel>
</rss>

