<?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 delete one column in all files in one library ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719095#M222610</link>
    <description>&lt;P&gt;Details&lt;/P&gt;
&lt;P&gt;Details&lt;/P&gt;
&lt;P&gt;Details&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lokk at how the macro parameter is written in the %MACRO statement, and how you try to use it in the macro body.&lt;/P&gt;</description>
    <pubDate>Sat, 13 Feb 2021 11:45:33 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-02-13T11:45:33Z</dc:date>
    <item>
      <title>How to delete one column in all files in one library ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/718981#M222541</link>
      <description>&lt;P&gt;Hi SAS Users,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a library named "&lt;STRONG&gt;_9b&lt;/STRONG&gt;", this library contains 64 files sas7bdat. All of these 64 files have the same variables, and the lengths of variables are not consistent. I am wondering if you can help me to generate the code to&lt;STRONG&gt; delete one column named "BDATE" through all 64 files in this library&lt;/STRONG&gt;( I want to delete this one because it is both numeric and character and useless in my dataset).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the information is not enough or I present not clear, please let me know.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks and warm regards.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2021 19:17:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/718981#M222541</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-02-12T19:17:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete one column in all files in one library ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/718982#M222542</link>
      <description>&lt;P&gt;Do you want to delete the variable for all SAS data sets in the library?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2021 19:19:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/718982#M222542</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-02-12T19:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete one column in all files in one library ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/718987#M222543</link>
      <description>&lt;P&gt;Really sounds like the data type issue should be corrected.&lt;/P&gt;
&lt;P&gt;Or probably even investigate how the data is brought into SAS with inconsistent results and prevent that from happening in the future. Especially if you have multiple variables that ending up with different lengths.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This a symptom of relying on Proc Import which makes guesses for ever file and leads to a number of data issues like you describe.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2021 19:25:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/718987#M222543</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-02-12T19:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete one column in all files in one library ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/718989#M222544</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to delete the variable "BDATE" through all dataset in this library.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2021 19:27:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/718989#M222544</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-02-12T19:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete one column in all files in one library ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719003#M222549</link>
      <description>&lt;P&gt;1. Identify which datasets have the column (sashelp.vcolumns)&lt;BR /&gt;2. Use PROC DATASETS or PROC SQL via CALL EXECUTE to drop them. &lt;BR /&gt;&lt;BR /&gt;Conceptually this could be done in a single data step&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2021 21:07:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719003#M222549</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-02-12T21:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete one column in all files in one library ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719006#M222552</link>
      <description>&lt;P&gt;the code to delete a variable from a data set is:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro delvar((lib, dsname, var2del);
data &amp;amp;lib..&amp;amp;dsname;
 set &amp;amp;lib..&amp;amp;dsname(drop=&amp;amp;var2del);
run;
%mend;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;wrap the code with a macro:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro delvar(lib,dsiname.var2del);
     data &amp;amp;lib..&amp;amp;dsname;
       set &amp;amp;lib..&amp;amp;dsname(drop=&amp;amp;var2del);
    run;
%mend;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;finally run next code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set sashelp.vtable(where=(libname='_9B';
       cmd = cats( '%delvar(', strip(libname), strip(memname), '&amp;lt;var 2 del&amp;gt;');
       call execute(cmd);
       put _N_= memname= ' was submitted to run' ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Feb 2021 20:47:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719006#M222552</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-02-12T20:47:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete one column in all files in one library ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719065#M222588</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I adjusted and applied this code and it does not work properly, can you please have a look?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;Libname _9b'C:\Users\pnguyen\OneDrive - Massey University\PhD JOURNEY\2Bfiltering' access=readonly;&lt;BR /&gt;proc contents data=_9b._ALL_ out=contents;&lt;BR /&gt;run;&lt;BR /&gt;/*******DROP BDATE**************/
%macro delvar(lib,dsiname,var2del);
     data &amp;amp;lib..&amp;amp;dsname;
       set &amp;amp;lib..&amp;amp;dsname(drop=&amp;amp;var2del);
    run;
%mend;

data _null_;
  set sashelp.vtable(where=(libname='_9B'));
       cmd = cats( '%delvar(', strip(libname), strip(memname), 'BDATE');
       call execute(cmd);
       put _N_= memname= ' was submitted to run' ;
run;

/*******************************/&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;However, the result turns out like that:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;NOTE: Data file _9B.ARGENTINA_MERGE2.DATA is in a format that is native to another host, or the file encoding does not match the 
      session encoding. Cross Environment Data Access will be used, which might require additional CPU resources and might reduce 
      performance.
ERROR: Macro parameter contains syntax error.
_N_=1 memname=ARGENTINA_MERGE2  was submitted to run
NOTE: Data file _9B.AUSTRALIA_MERGE2.DATA is in a format that is native to another host, or the file encoding does not match the 
      session encoding. Cross Environment Data Access will be used, which might require additional CPU resources and might reduce 
      performance.
ERROR: Macro parameter contains syntax error.
_N_=2 memname=AUSTRALIA_MERGE2  was submitted to run
NOTE: Data file _9B.AUSTRIA_MERGE2.DATA is in a format that is native to another host, or the file encoding does not match the 
      session encoding. Cross Environment Data Access will be used, which might require additional CPU resources and might reduce 
      performance.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I tried to find an answer from &lt;A href="https://communities.sas.com/t5/General-SAS-Programming/Data-file-is-in-a-format-that-is-native-to-another-host/td-p/433678" target="_self"&gt;another post&lt;/A&gt; but still do not know what is really going on, because I never faced such a problem when using SAS EG in my computer&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks and cheers,&lt;/P&gt;</description>
      <pubDate>Sat, 13 Feb 2021 05:14:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719065#M222588</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-02-13T05:14:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete one column in all files in one library ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719068#M222591</link>
      <description>&lt;P&gt;Sorry, my fault. CATS function need be replaced by CATX:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;cmd = catx(',', '%delvar(', strip(libname), strip(memname), 'BDATE'||');');&amp;nbsp;&lt;BR /&gt;put&amp;nbsp;cmd=;&amp;nbsp;/*&amp;nbsp;put&amp;nbsp;to&amp;nbsp;log&amp;nbsp;for&amp;nbsp;easy&amp;nbsp;debug&amp;nbsp;*/&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Feb 2021 06:02:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719068#M222591</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-02-13T06:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete one column in all files in one library ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719071#M222593</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your insightful idea, however, when I run the whole code as suggested:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint;&lt;BR /&gt;Libname  _9b'C:\Users\pnguyen\OneDrive - Massey University\PhD JOURNEY\2Bfiltering' access=readonly;
/*******DROP BDATE**************/
%macro delvar(lib,dsiname,var2del);
     data &amp;amp;lib..&amp;amp;dsname;
       set &amp;amp;lib..&amp;amp;dsname(drop=&amp;amp;var2del);
    run;
%mend;

data _null_;
  set sashelp.vtable(where=(libname='_9b'));
       cmd = catx( '%delvar(', strip(libname), strip(memname), 'BDATE');
       call execute(cmd);
       put _N_= memname= ' was submitted to run' ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The log when running such a code is as below:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;29         Libname  _9b'C:\Users\pnguyen\OneDrive - Massey University\PhD JOURNEY\2Bfiltering' access=readonly;
NOTE: Libref _9B was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\pnguyen\OneDrive - Massey University\PhD JOURNEY\2Bfiltering
30         
31         /*proc contents data=_9b._ALL_ out=contents;
32         run;*/
33         
34         /*******DROP BDATE**************/
35         %macro delvar(lib,dsiname,var2del);
36              data &amp;amp;lib..&amp;amp;dsname;
37                set &amp;amp;lib..&amp;amp;dsname(drop=&amp;amp;var2del);
38             run;
39         %mend;
40         
41         data _null_;
42           set sashelp.vtable(where=(libname='_9b'));
43                cmd = catx( '%delvar(', strip(libname), strip(memname), 'BDATE');
44                call execute(cmd);
45                put _N_= memname= ' was submitted to run' ;
46         run;

NOTE: There were 0 observations read from the data set SASHELP.VTABLE.
      WHERE libname='_9b';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It is clear that "&lt;CODE class=" language-sas"&gt;NOTE: There were 0 observations read from the data set SASHELP.VTABLE.
      WHERE libname='_9b';"&amp;nbsp;&lt;/CODE&gt;is&amp;nbsp;an&amp;nbsp;issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My directory path is as below:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="My97_0-1613197223954.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54680i5E8CE42629ECE0A8/image-size/large?v=v2&amp;amp;px=999" role="button" title="My97_0-1613197223954.png" alt="My97_0-1613197223954.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please help me to figure out my fallacy?&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;Warmest regards.&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;</description>
      <pubDate>Sat, 13 Feb 2021 06:20:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719071#M222593</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-02-13T06:20:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete one column in all files in one library ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719077#M222595</link>
      <description>&lt;P&gt;you did not copy the whole line with the CATX function.&lt;/P&gt;
&lt;P&gt;I have added 2 arguments :&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;(1) ',' at the beginning - this is the delimiter between macro arguments&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;(2) ');' as last argument to close the macro %delvar line&lt;/P&gt;
&lt;P&gt;I added also a "put cmd=;" to enable easy check of submitted line by call execute;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Feb 2021 06:46:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719077#M222595</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-02-13T06:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete one column in all files in one library ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719079#M222597</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;&amp;nbsp;Thank you for your update, but I still face the same problem, is there any solution then?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint;
Libname  _9b'C:\Users\pnguyen\OneDrive - Massey University\PhD JOURNEY\2Bfiltering' access=readonly;

/*******DROP BDATE**************/
%macro delvar(lib,dsiname,var2del);
     data &amp;amp;lib..&amp;amp;dsname;
       set &amp;amp;lib..&amp;amp;dsname(drop=&amp;amp;var2del);
    run;
%mend;

data _null_;
  set sashelp.vtable(where=(libname='_9b'));
       cmd = catx(',', '%delvar(', strip(libname), strip(memname), 'BDATE'||');'); put cmd=;
       call execute(cmd);
       put _N_= memname= ' was submitted to run' ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Log:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; options mprint;
29         Libname  _9b'C:\Users\pnguyen\OneDrive - Massey University\PhD JOURNEY\2Bfiltering' access=readonly;
NOTE: Libref _9B was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\pnguyen\OneDrive - Massey University\PhD JOURNEY\2Bfiltering
30         
31         /*proc contents data=_9b._ALL_ out=contents;
32         run;*/
33         
34         /*******DROP BDATE**************/
35         %macro delvar(lib,dsiname,var2del);
36              data &amp;amp;lib..&amp;amp;dsname;
37                set &amp;amp;lib..&amp;amp;dsname(drop=&amp;amp;var2del);
38             run;
39         %mend;
40         
41         data _null_;
42           set sashelp.vtable(where=(libname='_9b'));
43                cmd = catx(',', '%delvar(', strip(libname), strip(memname), 'BDATE'||');'); put cmd=;
44                call execute(cmd);
45                put _N_= memname= ' was submitted to run' ;
46         run;

NOTE: There were 0 observations read from the data set SASHELP.VTABLE.
      WHERE libname='_9b';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Many thanks!&lt;/P&gt;</description>
      <pubDate>Sat, 13 Feb 2021 08:02:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719079#M222597</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-02-13T08:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete one column in all files in one library ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719080#M222598</link>
      <description>&lt;P&gt;As much as I remember the data in sashelp.vtable is in uppercase.&lt;/P&gt;
&lt;P&gt;You can brows this dataset and check whether I'm right.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I coded "where libname=&lt;STRONG&gt;'_9B'&lt;/STRONG&gt;"&amp;nbsp; with capital letter, while you ran with "_9b" in lowcase.&lt;/P&gt;</description>
      <pubDate>Sat, 13 Feb 2021 08:08:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719080#M222598</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-02-13T08:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete one column in all files in one library ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719081#M222599</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your dedicated help so far. Actually, I tried both lowercase and uppercase but it not yet worked.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;28         options mprint;
29         Libname  _9b'C:\Users\pnguyen\OneDrive - Massey University\PhD JOURNEY\2Bfiltering' access=readonly;
NOTE: Libref _9B refers to the same physical library as SAS.
NOTE: Libref _9B was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\pnguyen\OneDrive - Massey University\PhD JOURNEY\2Bfiltering
30         
31         /*proc contents data=_9b._ALL_ out=contents;
32         run;*/
33         
34         /*******DROP BDATE**************/
35         %macro delvar(lib,dsiname,var2del);
36              data &amp;amp;lib..&amp;amp;dsname;
37                set &amp;amp;lib..&amp;amp;dsname(drop=&amp;amp;var2del);
38             run;
39         %mend;
40         
41         data _null_;
42           set sashelp.vtable(where=(libname='_9B'));
43                cmd = catx(',', '%delvar(', strip(libname), strip(memname), 'BDATE'||');'); put cmd=;
44                call execute(cmd);
45                put _N_= memname= ' was submitted to run' ;
46         run;

NOTE: There were 0 observations read from the data set SASHELP.VTABLE.
      WHERE libname='_9B';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Warm regards.&lt;/P&gt;</description>
      <pubDate>Sat, 13 Feb 2021 08:17:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719081#M222599</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-02-13T08:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete one column in all files in one library ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719083#M222600</link>
      <description>&lt;P&gt;Have you assigned a LIBNAME to that library ?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname _9B  '&amp;lt;path&amp;gt;/_9b';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;then chack again the sashelp.vtable.&lt;/P&gt;</description>
      <pubDate>Sat, 13 Feb 2021 08:28:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719083#M222600</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-02-13T08:28:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete one column in all files in one library ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719084#M222601</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code is that&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint;
Libname  _9b'C:\Users\pnguyen\OneDrive - Massey University\PhD JOURNEY\2Bfiltering' access=readonly;


/*******DROP BDATE**************/
%macro delvar(lib,dsiname,var2del);
     data &amp;amp;lib..&amp;amp;dsname;
       set &amp;amp;lib..&amp;amp;dsname(drop=&amp;amp;var2del);
    run;
%mend;

data _null_;
  set sashelp.vtable(where=(libname='_9B'));
       cmd = catx(',', '%delvar(', strip(libname), strip(memname), 'BDATE'||');'); put cmd=;
       call execute(cmd);
       put _N_= memname= ' was submitted to run' ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And the log is that, now the error is quite strange to me, because it is clear that there are three parameters in the macro.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;28         options mprint;
29         Libname  _9b'C:\Users\pnguyen\OneDrive - Massey University\PhD JOURNEY\2Bfiltering' access=readonly;
NOTE: Libref _9B was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\pnguyen\OneDrive - Massey University\PhD JOURNEY\2Bfiltering
30         
31         /*proc contents data=_9b._ALL_ out=contents;
32         run;*/
33         
34         /*******DROP BDATE**************/
35         %macro delvar(lib,dsiname,var2del);
36              data &amp;amp;lib..&amp;amp;dsname;
37                set &amp;amp;lib..&amp;amp;dsname(drop=&amp;amp;var2del);
38             run;
39         %mend;
40         
41         data _null_;
42           set sashelp.vtable(where=(libname='_9B'));
43                cmd = catx(',', '%delvar(', strip(libname), strip(memname), 'BDATE'||');'); put cmd=;
44                call execute(cmd);
45                put _N_= memname= ' was submitted to run' ;
46         run;

cmd=%delvar(,_9B,ARGENTINA_MERGE2_,BDATE);
ERROR: More positional parameters found than defined.
_N_=1 memname=ARGENTINA_MERGE2_  was submitted to run
cmd=%delvar(,_9B,AUSTRALIA_MERGE2_,BDATE);
ERROR: More positional parameters found than defined.
_N_=2 memname=AUSTRALIA_MERGE2_  was submitted to run
2                                                          The SAS System                          21:44 Saturday, February 13, 2021

cmd=%delvar(,_9B,AUSTRIA_MERGE2_,BDATE);
ERROR: More positional parameters found than defined.
_N_=3 memname=AUSTRIA_MERGE2_  was submitted to run
cmd=%delvar(,_9B,BELGIUM_MERGE2_,BDATE);
ERROR: More positional parameters found than defined.
_N_=4 memname=BELGIUM_MERGE2_  was submitted to run
cmd=%delvar(,_9B,BRAZIL_MERGE2_,BDATE);
ERROR: More positional parameters found than defined.
_N_=5 memname=BRAZIL_MERGE2_  was submitted to run
cmd=%delvar(,_9B,BULGARIA_MERGE2_,BDATE);
ERROR: More positional parameters found than defined.
_N_=6 memname=BULGARIA_MERGE2_  was submitted to run
cmd=%delvar(,_9B,CHILE_MERGE2_,BDATE);
ERROR: More positional parameters found than defined.
_N_=7 memname=CHILE_MERGE2_  was submitted to run
cmd=%delvar(,_9B,CHINA_MERGE2_,BDATE);
ERROR: More positional parameters found than defined.
_N_=8 memname=CHINA_MERGE2_  was submitted to run
cmd=%delvar(,_9B,COLOMBIA_MERGE2_,BDATE);
ERROR: More positional parameters found than defined.
&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Many thanks!&lt;/P&gt;</description>
      <pubDate>Sat, 13 Feb 2021 08:58:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719084#M222601</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-02-13T08:58:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete one column in all files in one library ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719087#M222603</link>
      <description>&lt;P&gt;Count the opening vs. closing brackets here:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;cmd = cats( '%delvar(', strip(libname), strip(memname), 'BDATE');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You need an additional closing bracket in the string.&lt;/P&gt;</description>
      <pubDate>Sat, 13 Feb 2021 09:05:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719087#M222603</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-02-13T09:05:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete one column in all files in one library ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719089#M222604</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did change such a code based on suggestion of&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;&amp;nbsp; but the result still be a mystery&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;cmd = catx(',', '%delvar(', strip(libname), strip(memname), 'BDATE'||');'); put cmd=&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Many thanks.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Sat, 13 Feb 2021 09:28:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719089#M222604</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-02-13T09:28:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete one column in all files in one library ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719090#M222605</link>
      <description>&lt;P&gt;Sorry, again my fault. There is an excess comma;&lt;/P&gt;
&lt;P&gt;line should be:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;cmd = catx(',', '%delvar('|| strip(libname), strip(memname), 'BDATE'||');'); put cmd=;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Feb 2021 09:41:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719090#M222605</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-02-13T09:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete one column in all files in one library ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719091#M222606</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your dedicated help&lt;/P&gt;
&lt;P&gt;The code is&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint;
Libname  _9b'C:\Users\pnguyen\OneDrive - Massey University\PhD JOURNEY\2Bfiltering' access=readonly;

/*proc contents data=_9b._ALL_ out=contents;
run;*/

/*******DROP BDATE**************/
%macro delvar(lib,dsiname,var2del);
     data &amp;amp;lib..&amp;amp;dsname;
       set &amp;amp;lib..&amp;amp;dsname(drop=&amp;amp;var2del);
    run;
%mend;

data _null_;
  set sashelp.vtable(where=(libname='_9B'));
       cmd = catx(',', '%delvar('|| strip(libname), strip(memname), 'BDATE'||');'); put cmd=;
       call execute(cmd);
       put _N_= memname= ' was submitted to run' ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now it exists a new error.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; options mprint;
29         Libname  _9b'C:\Users\pnguyen\OneDrive - Massey University\PhD JOURNEY\2Bfiltering' access=readonly;
NOTE: Libref _9B was successfully assigned as follows: 
      Engine:        V9 
      Physical Name: C:\Users\pnguyen\OneDrive - Massey University\PhD JOURNEY\2Bfiltering
30         
31         /*proc contents data=_9b._ALL_ out=contents;
32         run;*/
33         
34         /*******DROP BDATE**************/
35         %macro delvar(lib,dsiname,var2del);
36              data &amp;amp;lib..&amp;amp;dsname;
37                set &amp;amp;lib..&amp;amp;dsname(drop=&amp;amp;var2del);
38             run;
39         %mend;
40         
41         data _null_;
42           set sashelp.vtable(where=(libname='_9B'));
43                cmd = catx(',', '%delvar('|| strip(libname), strip(memname), 'BDATE'||');'); put cmd=;
44                call execute(cmd);
45                put _N_= memname= ' was submitted to run' ;
46         run;

NOTE: Data file _9B.ARGENTINA_MERGE2.DATA is in a format that is native to another host, or the file encoding does not match the 
      session encoding. Cross Environment Data Access will be used, which might require additional CPU resources and might reduce 
      performance.
cmd=%delvar(_9B,ARGENTINA_MERGE2,BDATE);
WARNING: Apparent symbolic reference DSNAME not resolved.
MPRINT(DELVAR):   data _9B.&amp;amp;dsname;
2                                                          The SAS System                          22:58 Saturday, February 13, 2021

WARNING: Apparent symbolic reference DSNAME not resolved.
MPRINT(DELVAR):   set _9B.&amp;amp;dsname(drop=BDATE);
MPRINT(DELVAR):   run;
_N_=1 memname=ARGENTINA_MERGE2  was submitted to run
NOTE: Data file _9B.AUSTRALIA_MERGE2.DATA is in a format that is native to another host, or the file encoding does not match the 
      session encoding. Cross Environment Data Access will be used, which might require additional CPU resources and might reduce 
      performance.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Warmest regards.&lt;/P&gt;</description>
      <pubDate>Sat, 13 Feb 2021 10:05:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719091#M222606</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-02-13T10:05:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete one column in all files in one library ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719095#M222610</link>
      <description>&lt;P&gt;Details&lt;/P&gt;
&lt;P&gt;Details&lt;/P&gt;
&lt;P&gt;Details&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lokk at how the macro parameter is written in the %MACRO statement, and how you try to use it in the macro body.&lt;/P&gt;</description>
      <pubDate>Sat, 13 Feb 2021 11:45:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-one-column-in-all-files-in-one-library/m-p/719095#M222610</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-02-13T11:45:33Z</dc:date>
    </item>
  </channel>
</rss>

