<?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 read .ok file to reconcile count and variable count in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-read-ok-file-to-reconcile-count-and-variable-count/m-p/276934#M7825</link>
    <description>&lt;P&gt;You can also collect the data into a single record for output:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
file '$HOME/infile';
put 'loaddate|30apr2016:10:00:07|';
put 'startdate|30apr2016:10:00:07|';
put 'count|4500|';
put 'pizza_id|41526|';
run;

data want (keep=loaddate startdate count pizza_id);
infile '$HOME/infile' dlm='|' end=done;
length name $10 value $20;
format
  loaddate
  startdate
    datetime18.
  count
  pizza_id
    5.
;
retain
  loaddate
  startdate
  count
  pizza_id
;
input name value;
select (name);
  when('loaddate') loaddate = input(value,datetime18.);
  when('startdate') startdate = input(value,datetime18.);
  when('count') count = input(value,5.);
  when('pizza_id') pizza_id = input(value,5.);
end;
if done then output;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Depending on what you do with the data, it might also make sense to just create macro variables (with call symput) for use in later code.&lt;/P&gt;</description>
    <pubDate>Mon, 13 Jun 2016 13:49:45 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2016-06-13T13:49:45Z</dc:date>
    <item>
      <title>How to read .ok file to reconcile count and variable count</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-read-ok-file-to-reconcile-count-and-variable-count/m-p/276895#M7821</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can any one help me to read .ok file in SAS DI sudio.&lt;/P&gt;&lt;P&gt;I am explaining the problem which I am facing below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Every month I will get monthly CSV file and .Ok trigger file for same with Date month time stamp.&lt;/P&gt;&lt;P&gt;Take an example- &amp;nbsp;Csv file name : XYZ_20160430.CSV&lt;/P&gt;&lt;P&gt;.ok File Name - XYZ_20160430.ok&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CSV file , simply I am reading as normal DI method.&lt;/P&gt;&lt;P&gt;But in .Ok file sturucture is as like below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;loaddate|30apr2016:10:00:07|&lt;/P&gt;&lt;P&gt;startdate|30apr2016:10:00:07|&lt;/P&gt;&lt;P&gt;count|4500|&lt;/P&gt;&lt;P&gt;pizzz_id|41526|&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note- &amp;nbsp;this count value is storing number of count of csv file, which will reconcile at next step.&lt;/P&gt;&lt;P&gt;same like pizz_id variable also.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;every month , count and pizza_id count can be differnet , which we need to reconcile at next step.&lt;/P&gt;&lt;P&gt;Dynamically, it will change every month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know .Ok file reader user written code to read this file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2016 11:47:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-read-ok-file-to-reconcile-count-and-variable-count/m-p/276895#M7821</guid>
      <dc:creator>Riteshdell</dc:creator>
      <dc:date>2016-06-13T11:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to read .ok file to reconcile count and variable count</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-read-ok-file-to-reconcile-count-and-variable-count/m-p/276901#M7822</link>
      <description>&lt;P&gt;Sounds like you have created your own delimited file type there, its not a standard one. &amp;nbsp;Anyways you can read delimeted files in as easily as you can CSV - which is also a delimited file:&lt;/P&gt;
&lt;PRE&gt;data want;
  length param result $200;
  infile "&amp;lt;path&amp;gt;\&amp;lt;file&amp;gt;.ok" dlm="|";
  input param $ result $;
  if param in ("loaddate","startdate") then dte=input(result,datetime.);
  else res_val=input(result,best.);
run;
&lt;/PRE&gt;
&lt;P&gt;This will give you a dataset called want, with a column for the first part, a column for the second, and two columns containing either dates, or numbers.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2016 12:19:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-read-ok-file-to-reconcile-count-and-variable-count/m-p/276901#M7822</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-06-13T12:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to read .ok file to reconcile count and variable count</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-read-ok-file-to-reconcile-count-and-variable-count/m-p/276924#M7824</link>
      <description>&lt;P&gt;I can see two possible paths here, which to chose is up to you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. This file doen't carry any data warehouse data. So it's not necessary&amp;nbsp;to include that in metadata for that reason. So you could have a validation function on file level implemented as a macro, or similar.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. You include this file into metadata, And yes, User Written&amp;nbsp;file, or eve a User Written transformation, if you have several files with the same logic/structure. The output should then be transposed (normalized).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The validation phase should also probably be a User Written transformation, since I don't see that will work seamlessly in a standard transformation.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2016 13:21:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-read-ok-file-to-reconcile-count-and-variable-count/m-p/276924#M7824</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-06-13T13:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to read .ok file to reconcile count and variable count</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-read-ok-file-to-reconcile-count-and-variable-count/m-p/276934#M7825</link>
      <description>&lt;P&gt;You can also collect the data into a single record for output:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
file '$HOME/infile';
put 'loaddate|30apr2016:10:00:07|';
put 'startdate|30apr2016:10:00:07|';
put 'count|4500|';
put 'pizza_id|41526|';
run;

data want (keep=loaddate startdate count pizza_id);
infile '$HOME/infile' dlm='|' end=done;
length name $10 value $20;
format
  loaddate
  startdate
    datetime18.
  count
  pizza_id
    5.
;
retain
  loaddate
  startdate
  count
  pizza_id
;
input name value;
select (name);
  when('loaddate') loaddate = input(value,datetime18.);
  when('startdate') startdate = input(value,datetime18.);
  when('count') count = input(value,5.);
  when('pizza_id') pizza_id = input(value,5.);
end;
if done then output;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Depending on what you do with the data, it might also make sense to just create macro variables (with call symput) for use in later code.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jun 2016 13:49:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-read-ok-file-to-reconcile-count-and-variable-count/m-p/276934#M7825</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-06-13T13:49:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to read .ok file to reconcile count and variable count</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-read-ok-file-to-reconcile-count-and-variable-count/m-p/277139#M7831</link>
      <description>Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; - its working...thanks a lot for your valuable help.</description>
      <pubDate>Tue, 14 Jun 2016 07:29:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-read-ok-file-to-reconcile-count-and-variable-count/m-p/277139#M7831</guid>
      <dc:creator>Riteshdell</dc:creator>
      <dc:date>2016-06-14T07:29:25Z</dc:date>
    </item>
  </channel>
</rss>

