<?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 filedialog sas 9.3 vs sas 9.4 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/filedialog-sas-9-3-vs-sas-9-4/m-p/345718#M79573</link>
    <description>&lt;P&gt;Dear All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a problem concerning 32bit vs 64bit in sas. (sas 9.3 vs sas 9.4)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using&amp;nbsp;a procedure that allows me to open a filedialog for the users of my programs. (it is really user friendly)&lt;/P&gt;
&lt;P&gt;i didnt write it my self (lex janssens was my inspiration). (see attachement).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In 9.4 it gives me problems.&lt;/P&gt;
&lt;P&gt;i added dlltype=32 because apparently 9.4 is 64bit and cannot compile 32bit.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the program runs but it won't save the location of the file.&lt;/P&gt;
&lt;P&gt;giving the error : you cannot use addr but have to use addrlong.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;however changing addr to addrlong gives more errors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does anyone has a solution for this problem. (attachement has the program)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Mar 2017 12:16:47 GMT</pubDate>
    <dc:creator>BartDekeyser</dc:creator>
    <dc:date>2017-03-30T12:16:47Z</dc:date>
    <item>
      <title>filedialog sas 9.3 vs sas 9.4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filedialog-sas-9-3-vs-sas-9-4/m-p/345718#M79573</link>
      <description>&lt;P&gt;Dear All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a problem concerning 32bit vs 64bit in sas. (sas 9.3 vs sas 9.4)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using&amp;nbsp;a procedure that allows me to open a filedialog for the users of my programs. (it is really user friendly)&lt;/P&gt;
&lt;P&gt;i didnt write it my self (lex janssens was my inspiration). (see attachement).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In 9.4 it gives me problems.&lt;/P&gt;
&lt;P&gt;i added dlltype=32 because apparently 9.4 is 64bit and cannot compile 32bit.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the program runs but it won't save the location of the file.&lt;/P&gt;
&lt;P&gt;giving the error : you cannot use addr but have to use addrlong.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;however changing addr to addrlong gives more errors.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does anyone has a solution for this problem. (attachement has the program)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2017 12:16:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filedialog-sas-9-3-vs-sas-9-4/m-p/345718#M79573</guid>
      <dc:creator>BartDekeyser</dc:creator>
      <dc:date>2017-03-30T12:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: filedialog sas 9.3 vs sas 9.4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filedialog-sas-9-3-vs-sas-9-4/m-p/345797#M79612</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Select a file from a pop up dialog box and list the file

requires Python

inspired by ( this is a link to this message)
https://goo.gl/eKhTYt
https://communities.sas.com/t5/Base-SAS-Programming/filedialog-sas-9-3-vs-sas-9-4/m-p/345718

Doable in R but I like Python and SAS/WPS for these kinds of problems


HAVE ( A directory with some files (chose your own directory)
==============================================================

Directory of d:/txt

 fyl.txt
 hex.txt
 hexout.txt
 myfile.txt
 utf16le.txt
 UtlChkFyl.txt    ==&amp;gt; click on this one

WANT ( select and print file  )
===============================
  click on

       UtlChkFyl.txt

And this will appear in log

%macro utlchkfyl(file);
  %if %sysfunc(fileexist(&amp;amp;file)) ge 1 %then %do;
    %let rc=%sysfunc(filename(temp,&amp;amp;file));
    %let rc=%sysfunc(fdelete(&amp;amp;temp));
  %end;
%else %put The file &amp;amp;file does not exist;
%mend utlchkfyl;


WORKING CODE (PYTHON)
=====================

       fyl = tkFileDialog.askopenfilename(filetypes=[('Text files', '*.txt')]);

INVOCATION
==========

       %SelDir(c:/txt);

*          _       _   _
 ___  ___ | |_   _| |_(_) ___  _ __
/ __|/ _ \| | | | | __| |/ _ \| '_ \
\__ \ (_) | | |_| | |_| | (_) | | | |
|___/\___/|_|\__,_|\__|_|\___/|_| |_|

;

%macro SelDir(dir);

   %utl_submit_py64("
   import os;
   import tkFileDialog;
   import os;
   os.chdir('&amp;amp;dir');
   fyl = tkFileDialog.askopenfilename(filetypes=[('Text files', '*.txt')]);
   fo= open ('d:/txt/fyl.txt', 'w');
   fo.write(fyl+'\n');
   fo.close();
   ");

   * could also use filevar in infile;
   * but I think it is worth learning and using this method;

   data _null_;

    if _n_=0 then do;
     %let rc=%sysfunc(dosubl('
      data _null_;
         infile "d:/txt/fyl.txt";
         input;
         fylvar=strip(_infile_);
         call symputx("fyl",fylvar);
      run;quit;
    '));
    end;

     infile "&amp;amp;fyl";
     input;
     put _infile_;

   run;quit;

%mend SelDir;

%SelDir(d:/txt);


%macro utl_submit_py64(pgm)/des="Semi colon separated set of py commands";
  * write the program to a temporary file;
  filename py_pgm "%sysfunc(pathname(work))/py_pgm.py" lrecl=32766 recfm=v;
  data _null_;
    length pgm  $32755 cmd $1024;
    file py_pgm ;
    pgm=&amp;amp;pgm;
    semi=countc(pgm,';');
      do idx=1 to semi;
        cmd=compbl(cats(scan(pgm,idx,';')));
        if cmd=:'.' then cmd=substr(cmd,2);
        put cmd $char384.;
        putlog cmd $char384.;
      end;
  run;

  run;quit;
  %let _loc=%sysfunc(pathname(py_pgm));
  %put &amp;amp;_loc;
  filename rut pipe  "C:\Python_27_64bit/python.exe &amp;amp;_loc";
  data _null_;
    file print;
    infile rut;
    input;
    put _infile_;
  run;
  filename rut clear;
  filename py_pgm clear;
%mend utl_submit_py64;



&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Mar 2017 15:36:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filedialog-sas-9-3-vs-sas-9-4/m-p/345797#M79612</guid>
      <dc:creator>rogerjdeangelis</dc:creator>
      <dc:date>2017-03-30T15:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: filedialog sas 9.3 vs sas 9.4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filedialog-sas-9-3-vs-sas-9-4/m-p/346041#M79722</link>
      <description>&lt;P&gt;thanks for the reply but we dont have python.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2017 06:10:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filedialog-sas-9-3-vs-sas-9-4/m-p/346041#M79722</guid>
      <dc:creator>BartDekeyser</dc:creator>
      <dc:date>2017-03-31T06:10:44Z</dc:date>
    </item>
  </channel>
</rss>

