<?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 Modification date of a dataset is affected by timezone. How to avoid it? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Modification-date-of-a-dataset-is-affected-by-timezone-How-to/m-p/705243#M216293</link>
    <description>&lt;P&gt;There is a need to copy a SAS dataset between remote servers, then periodically check whether this dataset has been modified since the last check. If it has been modified then copy it again. The source and target servers have different encoding, so I need to re-build this dataset to make it correspond to a new encoding, but at the same time I want to preserve its metadata (modate) to be able to determine whether it was modified. So, to copy it I use &lt;STRONG&gt;proc datasets;&amp;nbsp;copy&amp;nbsp;&lt;/STRONG&gt;with&amp;nbsp;&lt;EM&gt;noclone&amp;nbsp;&lt;/EM&gt;and&amp;nbsp;&lt;EM&gt;datecopy&amp;nbsp;&lt;/EM&gt;options:&lt;/P&gt;&lt;P&gt;proc datasets;&lt;BR /&gt;copy&lt;BR /&gt;out=&amp;amp;sourcelib.&lt;BR /&gt;noclone&lt;BR /&gt;datecopy&lt;BR /&gt;in=&amp;amp;targetlib.;&lt;BR /&gt;select &amp;amp;source_name.;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when when this dataset is copied, its modification date (modate) is changed by several hours reflecting the timezone of my session (which is different from the timezone of the source server). So, for example, the dataset was modified at 11DEC20:10:23:55, but the modate after copying would show 11DEC20:12:23:55. And now if I compare the modification dates of this dataset located at the source and target servers - they will be different and I cannot determine that it has been modified.&lt;/P&gt;&lt;P&gt;How to avoid this problem with the timezone? Can I force SAS not to change modification date? Or is there another solution to determine that the dataset has been modified?&lt;/P&gt;&lt;P&gt;Would appreciate any help.&lt;/P&gt;</description>
    <pubDate>Fri, 11 Dec 2020 06:20:41 GMT</pubDate>
    <dc:creator>pavelr</dc:creator>
    <dc:date>2020-12-11T06:20:41Z</dc:date>
    <item>
      <title>Modification date of a dataset is affected by timezone. How to avoid it?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modification-date-of-a-dataset-is-affected-by-timezone-How-to/m-p/705243#M216293</link>
      <description>&lt;P&gt;There is a need to copy a SAS dataset between remote servers, then periodically check whether this dataset has been modified since the last check. If it has been modified then copy it again. The source and target servers have different encoding, so I need to re-build this dataset to make it correspond to a new encoding, but at the same time I want to preserve its metadata (modate) to be able to determine whether it was modified. So, to copy it I use &lt;STRONG&gt;proc datasets;&amp;nbsp;copy&amp;nbsp;&lt;/STRONG&gt;with&amp;nbsp;&lt;EM&gt;noclone&amp;nbsp;&lt;/EM&gt;and&amp;nbsp;&lt;EM&gt;datecopy&amp;nbsp;&lt;/EM&gt;options:&lt;/P&gt;&lt;P&gt;proc datasets;&lt;BR /&gt;copy&lt;BR /&gt;out=&amp;amp;sourcelib.&lt;BR /&gt;noclone&lt;BR /&gt;datecopy&lt;BR /&gt;in=&amp;amp;targetlib.;&lt;BR /&gt;select &amp;amp;source_name.;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when when this dataset is copied, its modification date (modate) is changed by several hours reflecting the timezone of my session (which is different from the timezone of the source server). So, for example, the dataset was modified at 11DEC20:10:23:55, but the modate after copying would show 11DEC20:12:23:55. And now if I compare the modification dates of this dataset located at the source and target servers - they will be different and I cannot determine that it has been modified.&lt;/P&gt;&lt;P&gt;How to avoid this problem with the timezone? Can I force SAS not to change modification date? Or is there another solution to determine that the dataset has been modified?&lt;/P&gt;&lt;P&gt;Would appreciate any help.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Dec 2020 06:20:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modification-date-of-a-dataset-is-affected-by-timezone-How-to/m-p/705243#M216293</guid>
      <dc:creator>pavelr</dc:creator>
      <dc:date>2020-12-11T06:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: Modification date of a dataset is affected by timezone. How to avoid it?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modification-date-of-a-dataset-is-affected-by-timezone-How-to/m-p/705253#M216301</link>
      <description>&lt;P&gt;I don't see an easy solution for this problem. Maybe an os-command can change/manipulate the modification date after the dataset was copied. You could store the original modification date in an &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=proc&amp;amp;docsetTarget=n0cv90wy4n3n86n1ru10jvzx7r9u.htm" target="_self"&gt;extend attribute&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Just an idea:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* something to play with, work.cars acts as source */
data work.cars;
   set sashelp.cars;
run;

/* Store the modification date in the macro variable "modDate" */
data _null_;
   set sashelp.vtable(where=(Libname = 'WORK' and Memname = 'CARS'));
   call symputx('modDate', modate);
run;

/* Copy, sasuser acts as target-lib */
proc datasets nolist;
   copy out=sasuser in=work noclone datecopy;
      select cars;
quit;

/* Add the extend attribute */
proc datasets library= sasuser nolist;
   modify cars;
      xattr add ds original_mod_date = &amp;amp;modDate.;
quit;

/* Later compare the current modification date with the xattr
 * Execute only the first data-step creating work.cars to simulate an
 * update of your source dataset */
data _null_;
   set sashelp.vxattr( 
      where= (Libname = 'SASUSER' and Memname = 'CARS' 
      and lowcase(xattr) = 'original_mod_date')
   );
   set sashelp.vtable(
      keep= Libname Memname Modate
      where= (Libname = 'WORK' and Memname = 'CARS')
   );

   CloneModDate = input(xvalue, best.);

   put CloneModDate= datetime.;
   put modate=;

   if intck('DTSECONDS', modate, CloneModDate) then do;
      put "Dataset was updated";
   end;
   else do;
      put "Still unchanged";
   end;

   call symputx('has_changed', intck('DTSECONDS', modate, CloneModDate) ^= 0);
run;

%put &amp;amp;=has_changed;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Dec 2020 07:46:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modification-date-of-a-dataset-is-affected-by-timezone-How-to/m-p/705253#M216301</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2020-12-11T07:46:36Z</dc:date>
    </item>
  </channel>
</rss>

