sas, error messages, fdelete, delete xlsx file











up vote
0
down vote

favorite
1












I am trying to delete an XLSX file on the unix server and getting error messages. Below is my code. How can I delete this file in SAS EG? I need code to do this. Below are the error messages that I am getting.



filename myfile "/server/department/users/id/test/POP_ID.xlsx";
data _null_;
rc=fdelete("myfile");
run;
filename myfileclear;




ERROR: Invalid logical name.
ERROR: Error in the FILENAME statement.









share|improve this question
























  • Good practice is to serve the file read-only through a web service download. That way you can replace it (delete/recreate) without worrying about file locks, as could happen if file opened by Excel from a network share.
    – Richard
    Nov 13 at 16:59















up vote
0
down vote

favorite
1












I am trying to delete an XLSX file on the unix server and getting error messages. Below is my code. How can I delete this file in SAS EG? I need code to do this. Below are the error messages that I am getting.



filename myfile "/server/department/users/id/test/POP_ID.xlsx";
data _null_;
rc=fdelete("myfile");
run;
filename myfileclear;




ERROR: Invalid logical name.
ERROR: Error in the FILENAME statement.









share|improve this question
























  • Good practice is to serve the file read-only through a web service download. That way you can replace it (delete/recreate) without worrying about file locks, as could happen if file opened by Excel from a network share.
    – Richard
    Nov 13 at 16:59













up vote
0
down vote

favorite
1









up vote
0
down vote

favorite
1






1





I am trying to delete an XLSX file on the unix server and getting error messages. Below is my code. How can I delete this file in SAS EG? I need code to do this. Below are the error messages that I am getting.



filename myfile "/server/department/users/id/test/POP_ID.xlsx";
data _null_;
rc=fdelete("myfile");
run;
filename myfileclear;




ERROR: Invalid logical name.
ERROR: Error in the FILENAME statement.









share|improve this question















I am trying to delete an XLSX file on the unix server and getting error messages. Below is my code. How can I delete this file in SAS EG? I need code to do this. Below are the error messages that I am getting.



filename myfile "/server/department/users/id/test/POP_ID.xlsx";
data _null_;
rc=fdelete("myfile");
run;
filename myfileclear;




ERROR: Invalid logical name.
ERROR: Error in the FILENAME statement.






sas






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 at 14:27

























asked Nov 13 at 14:21









coder1167

1076




1076












  • Good practice is to serve the file read-only through a web service download. That way you can replace it (delete/recreate) without worrying about file locks, as could happen if file opened by Excel from a network share.
    – Richard
    Nov 13 at 16:59


















  • Good practice is to serve the file read-only through a web service download. That way you can replace it (delete/recreate) without worrying about file locks, as could happen if file opened by Excel from a network share.
    – Richard
    Nov 13 at 16:59
















Good practice is to serve the file read-only through a web service download. That way you can replace it (delete/recreate) without worrying about file locks, as could happen if file opened by Excel from a network share.
– Richard
Nov 13 at 16:59




Good practice is to serve the file read-only through a web service download. That way you can replace it (delete/recreate) without worrying about file locks, as could happen if file opened by Excel from a network share.
– Richard
Nov 13 at 16:59












2 Answers
2






active

oldest

votes

















up vote
3
down vote



accepted










I believe the error relates to your last filename statement, where the ref is longer than 8 chars and the clear runs into the filename. I suspect if you add a space it will be fine.



filename myfileclear;


Should be:



filename myfile clear;





share|improve this answer




























    up vote
    0
    down vote













    This worked for me. I deleted filename myfileclear;.



    %let outdir=/server/department/users/id/test;
    filename myfile "&outdir/POP_ID.xlsx";
    data _null_;
    rc=fdelete("myfile");
    run;
    proc export DATA=OUT1.POP_ID_5C
    OUTFILE= "&outdir/POP_ID.xlsx"
    DBMS=xlsx REPLACE ;
    SHEET = "POP_ID";
    proc export DATA=OUT1.REQ_1_4_04T1
    OUTFILE= "&outdir/POP_ID.xlsx"
    DBMS=xlsx REPLACE ;
    SHEET = "REQ_1_4";





    share|improve this answer





















      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53283115%2fsas-error-messages-fdelete-delete-xlsx-file%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      3
      down vote



      accepted










      I believe the error relates to your last filename statement, where the ref is longer than 8 chars and the clear runs into the filename. I suspect if you add a space it will be fine.



      filename myfileclear;


      Should be:



      filename myfile clear;





      share|improve this answer

























        up vote
        3
        down vote



        accepted










        I believe the error relates to your last filename statement, where the ref is longer than 8 chars and the clear runs into the filename. I suspect if you add a space it will be fine.



        filename myfileclear;


        Should be:



        filename myfile clear;





        share|improve this answer























          up vote
          3
          down vote



          accepted







          up vote
          3
          down vote



          accepted






          I believe the error relates to your last filename statement, where the ref is longer than 8 chars and the clear runs into the filename. I suspect if you add a space it will be fine.



          filename myfileclear;


          Should be:



          filename myfile clear;





          share|improve this answer












          I believe the error relates to your last filename statement, where the ref is longer than 8 chars and the clear runs into the filename. I suspect if you add a space it will be fine.



          filename myfileclear;


          Should be:



          filename myfile clear;






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 13 at 16:08









          Reeza

          12.9k21126




          12.9k21126
























              up vote
              0
              down vote













              This worked for me. I deleted filename myfileclear;.



              %let outdir=/server/department/users/id/test;
              filename myfile "&outdir/POP_ID.xlsx";
              data _null_;
              rc=fdelete("myfile");
              run;
              proc export DATA=OUT1.POP_ID_5C
              OUTFILE= "&outdir/POP_ID.xlsx"
              DBMS=xlsx REPLACE ;
              SHEET = "POP_ID";
              proc export DATA=OUT1.REQ_1_4_04T1
              OUTFILE= "&outdir/POP_ID.xlsx"
              DBMS=xlsx REPLACE ;
              SHEET = "REQ_1_4";





              share|improve this answer

























                up vote
                0
                down vote













                This worked for me. I deleted filename myfileclear;.



                %let outdir=/server/department/users/id/test;
                filename myfile "&outdir/POP_ID.xlsx";
                data _null_;
                rc=fdelete("myfile");
                run;
                proc export DATA=OUT1.POP_ID_5C
                OUTFILE= "&outdir/POP_ID.xlsx"
                DBMS=xlsx REPLACE ;
                SHEET = "POP_ID";
                proc export DATA=OUT1.REQ_1_4_04T1
                OUTFILE= "&outdir/POP_ID.xlsx"
                DBMS=xlsx REPLACE ;
                SHEET = "REQ_1_4";





                share|improve this answer























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  This worked for me. I deleted filename myfileclear;.



                  %let outdir=/server/department/users/id/test;
                  filename myfile "&outdir/POP_ID.xlsx";
                  data _null_;
                  rc=fdelete("myfile");
                  run;
                  proc export DATA=OUT1.POP_ID_5C
                  OUTFILE= "&outdir/POP_ID.xlsx"
                  DBMS=xlsx REPLACE ;
                  SHEET = "POP_ID";
                  proc export DATA=OUT1.REQ_1_4_04T1
                  OUTFILE= "&outdir/POP_ID.xlsx"
                  DBMS=xlsx REPLACE ;
                  SHEET = "REQ_1_4";





                  share|improve this answer












                  This worked for me. I deleted filename myfileclear;.



                  %let outdir=/server/department/users/id/test;
                  filename myfile "&outdir/POP_ID.xlsx";
                  data _null_;
                  rc=fdelete("myfile");
                  run;
                  proc export DATA=OUT1.POP_ID_5C
                  OUTFILE= "&outdir/POP_ID.xlsx"
                  DBMS=xlsx REPLACE ;
                  SHEET = "POP_ID";
                  proc export DATA=OUT1.REQ_1_4_04T1
                  OUTFILE= "&outdir/POP_ID.xlsx"
                  DBMS=xlsx REPLACE ;
                  SHEET = "REQ_1_4";






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 13 at 14:47









                  coder1167

                  1076




                  1076






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53283115%2fsas-error-messages-fdelete-delete-xlsx-file%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      How to change which sound is reproduced for terminal bell?

                      Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

                      Can I use Tabulator js library in my java Spring + Thymeleaf project?