<?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 problem with sas code in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/problem-with-sas-code/m-p/377590#M90685</link>
    <description>&lt;P&gt;I am importing the attached dataset using the INFILE statement. But the 'quantity' 'sales' and 'profit' variables have missing values against them, Please have a look.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data inf_globalsale;&lt;BR /&gt;infile'/folders/myfolders/global_sale.csv'&lt;BR /&gt;LRECL=60000 DLM=',' FIRSTOBS=2;&lt;BR /&gt;informat Order_ID$32. Order_Date ddmmyy10. Ship_Date ddmmyy10. Customer_ID$32. Segment$32. Country$32. Category$32. Sales dollar10.2;&lt;BR /&gt;format Order_Date ddmmyy10. Ship_Date ddmmyy10. Sales dollar10.2;&lt;BR /&gt;input Order_ID$ Order_Date Ship_Date Customer_ID$ Segment$ City$ State$ Country$ Category$ Sales Quantity Discount Profit;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc print data=inf_globalsale;&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Jul 2017 21:01:20 GMT</pubDate>
    <dc:creator>atulsingh</dc:creator>
    <dc:date>2017-07-19T21:01:20Z</dc:date>
    <item>
      <title>problem with sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-with-sas-code/m-p/377590#M90685</link>
      <description>&lt;P&gt;I am importing the attached dataset using the INFILE statement. But the 'quantity' 'sales' and 'profit' variables have missing values against them, Please have a look.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data inf_globalsale;&lt;BR /&gt;infile'/folders/myfolders/global_sale.csv'&lt;BR /&gt;LRECL=60000 DLM=',' FIRSTOBS=2;&lt;BR /&gt;informat Order_ID$32. Order_Date ddmmyy10. Ship_Date ddmmyy10. Customer_ID$32. Segment$32. Country$32. Category$32. Sales dollar10.2;&lt;BR /&gt;format Order_Date ddmmyy10. Ship_Date ddmmyy10. Sales dollar10.2;&lt;BR /&gt;input Order_ID$ Order_Date Ship_Date Customer_ID$ Segment$ City$ State$ Country$ Category$ Sales Quantity Discount Profit;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc print data=inf_globalsale;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 21:01:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-with-sas-code/m-p/377590#M90685</guid>
      <dc:creator>atulsingh</dc:creator>
      <dc:date>2017-07-19T21:01:20Z</dc:date>
    </item>
    <item>
      <title>Re: problem with sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-with-sas-code/m-p/377603#M90690</link>
      <description>&lt;P&gt;One you probably want to use the DSD option to properly handle missing values. &amp;nbsp;Also both PROFIT and SALES need to use the COMMA (or DOLLAR) informat to handle the dollar signs and commas that appear in the data.&lt;/P&gt;
&lt;P&gt;Also do NOT include a decimal specification on a INFORMAT unless you know that the decimal points do NOT appear in the text strings and need to be added to get the proper magnitude of the numbers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data inf_globalsale;
  infile "&amp;amp;path/global_sale.csv" dsd firstobs=2  ;
  length Order_ID $32 Order_Date Ship_Date 8 
         Customer_ID Segment City $32 State $8 Country $32 
         Category $32 Sales Quantity Discount Profit 8
  ;
  informat Order_Date Ship_Date ddmmyy. Sales Profit dollar.;
  format Order_Date Ship_Date yymmdd10. ;
  input Order_ID -- Profit;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Let's print some of the values to see if it worked.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=&amp;amp;syslast(obs=5);
 var Order_Date Sales--Profit ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result.&lt;/P&gt;
&lt;PRE&gt;Obs    Order_Date     Sales     Quantity    Discount     Profit

  1    2014-11-11     221.98        2          0.0        62.15
  2    2014-02-05    3709.40        9          0.1      -288.77
  3    2014-10-17    5175.17        9          0.1       919.97
  4    2014-01-28    2892.51        5          0.1       -96.54
  5    2014-11-05    2832.96        8          0.0       311.52&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 21:21:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-with-sas-code/m-p/377603#M90690</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-07-19T21:21:15Z</dc:date>
    </item>
    <item>
      <title>Re: problem with sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/problem-with-sas-code/m-p/377608#M90692</link>
      <description>&lt;P&gt;An alternative but good to know solution is to let SAS do the work for you and, if needed, modify the resulting code. e.g.:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc import datafile='/folders/myfolders/global_sale.csv' out=inf_globalsale dbms=csv replace;
run;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the present case three additional variables will be imported, as you have a stray character in one of the non-used columns after your data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 21:24:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/problem-with-sas-code/m-p/377608#M90692</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-07-19T21:24:28Z</dc:date>
    </item>
  </channel>
</rss>

