<?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: DI Studio Getting  Invalid physical name error when trying to write a file in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Getting-Invalid-physical-name-error-when-trying-to/m-p/565723#M17380</link>
    <description>&lt;P&gt;Sorry I didn't get this in and tested quicker, but I had jury duty.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your solution worked perfectly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the file name that was created, which is exactly what I was looking for.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FDTTEST_2019-06-12.upd&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
    <pubDate>Thu, 13 Jun 2019 01:33:10 GMT</pubDate>
    <dc:creator>gsmith</dc:creator>
    <dc:date>2019-06-13T01:33:10Z</dc:date>
    <item>
      <title>DI Studio Getting  Invalid physical name error when trying to write a file</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Getting-Invalid-physical-name-error-when-trying-to/m-p/564599#M17344</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a file which has a date stamp appended to the file name. I've created my parameter, correctly I think.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* Parameter default value(s) for File date test */&lt;BR /&gt;%let datetimef_label = Current date and time (June 7, 2019 04:32:54 PM);&lt;BR /&gt;%let datetimef = 07Jun2019 16:32:54;&lt;BR /&gt;%let datetimef_rel = T0m;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then my precode&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*---- Start of Pre-Process Code ----*/&lt;/P&gt;&lt;P&gt;%let datetimef=%sysfunc(datetime(),yymmddd10.);&lt;BR /&gt;/*---- End of Pre-Process Code ----*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yet when I run it I get the following error in the log: (The physical&amp;nbsp; location is a real place. I use it for other jobs identical to this one except those do not have the datetime parameter.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This physical location works on the job that works.&amp;nbsp; file "\\As-i2i01\udp_in\Input\PAT9.upd" dlm='|';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This one fails on the job with the datetime.&amp;nbsp; &amp;nbsp; &amp;nbsp; file "\\As-i2i01\udp_in\Input\FDTTEST_&amp;amp;datetimef.upd" dlm='|';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the log:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;195 data _null_;&lt;BR /&gt;196 set &amp;amp;SYSLAST;&lt;BR /&gt;197 attrib RecordType length = $12;&lt;BR /&gt;198 attrib RecordAction length = $8;&lt;BR /&gt;199 attrib EventTypeID length = 8;&lt;BR /&gt;200 attrib SourceID length = $8;&lt;BR /&gt;201 attrib Value length = $255;&lt;BR /&gt;202 attrib EventCount length = $8;&lt;BR /&gt;203 attrib LastEventDate length = $8;&lt;BR /&gt;204 attrib LastSourceEditDate length = $8;&lt;BR /&gt;205 quote='"';&lt;BR /&gt;206 file "\\As-i2i01\udp_in\Input\FDTTEST_&amp;amp;datetimef.upd" dlm='|';&lt;BR /&gt;207&lt;BR /&gt;208 put&lt;BR /&gt;209 quote +(-1) RecordType +(-1) quote&lt;BR /&gt;210 quote +(-1) RecordAction +(-1) quote&lt;BR /&gt;211 quote +(-1) EventTypeID +(-1) quote&lt;BR /&gt;212 quote +(-1) SourceID +(-1) quote&lt;BR /&gt;213 quote +(-1) Value +(-1) quote&lt;BR /&gt;214 quote +(-1) EventCount +(-1) quote&lt;BR /&gt;215 quote +(-1) LastEventDate +(-1) quote&lt;BR /&gt;216 quote +(-1) LastSourceEditDate +(-1) quote&lt;BR /&gt;217 ;&lt;BR /&gt;218&lt;BR /&gt;219 run;&lt;/P&gt;&lt;P&gt;ERROR: Invalid physical name.&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jun 2019 00:45:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Getting-Invalid-physical-name-error-when-trying-to/m-p/564599#M17344</guid>
      <dc:creator>gsmith</dc:creator>
      <dc:date>2019-06-08T00:45:11Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio Getting  Invalid physical name error when trying to write a file</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Getting-Invalid-physical-name-error-when-trying-to/m-p/564605#M17346</link>
      <description>&lt;P&gt;have you set the options to allow for crappy file names containing spaces and minues?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jun 2019 01:34:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Getting-Invalid-physical-name-error-when-trying-to/m-p/564605#M17346</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-06-08T01:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio Getting  Invalid physical name error when trying to write a file</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Getting-Invalid-physical-name-error-when-trying-to/m-p/564739#M17350</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/113201"&gt;@gsmith&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The problem is caused by the macro variable&amp;nbsp;datetimef. You use a date-format on a datetime-value, so you ask SAS to take the number of seconds since 10 jan 1960 - right now it is 1875696783,&amp;nbsp;and use it as the number of days. The largest date value in SAS is 2936547, so your value is larger than the max. date, and the formatted value becomes &amp;nbsp;a string of stars instead of a formatted date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have a look at these 3 examples. Only the last gives a valid filename:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;192  %let datetimef=%sysfunc(datetime(),yymmddd10.);
193  %put &amp;amp;=datetimef;
DATETIMEF=**********
194
195  %let datetimef=%sysfunc(datetime(),datetime22.0);
196  %put &amp;amp;=datetimef;
DATETIMEF=09JUN2019:10:56:57
197
198  %let datetimef=%sysfunc(date(),yymmddd10.);
199  %put &amp;amp;=datetimef;
DATETIMEF=2019-06-09

&lt;/PRE&gt;
&lt;P&gt;By the way - You don't get the filename you expect, because the dot disappears. It is taken as a terminator for the macro variable, so you don't get the filetype separated from the file name. You need 2 dots:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;201  data _null_;
202      a =  "c:\temp\FDTTEST_&amp;amp;datetimef.upd";
203      put a;
204
205      a =  "c:\temp\FDTTEST_&amp;amp;datetimef..upd";
206      put a;
207  run;

c:\temp\FDTTEST_2019-06-09upd
c:\temp\FDTTEST_2019-06-09.up
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jun 2019 09:04:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Getting-Invalid-physical-name-error-when-trying-to/m-p/564739#M17350</guid>
      <dc:creator>ErikLund_Jensen</dc:creator>
      <dc:date>2019-06-09T09:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: DI Studio Getting  Invalid physical name error when trying to write a file</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Getting-Invalid-physical-name-error-when-trying-to/m-p/565723#M17380</link>
      <description>&lt;P&gt;Sorry I didn't get this in and tested quicker, but I had jury duty.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your solution worked perfectly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the file name that was created, which is exactly what I was looking for.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FDTTEST_2019-06-12.upd&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 01:33:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/DI-Studio-Getting-Invalid-physical-name-error-when-trying-to/m-p/565723#M17380</guid>
      <dc:creator>gsmith</dc:creator>
      <dc:date>2019-06-13T01:33:10Z</dc:date>
    </item>
  </channel>
</rss>

