<?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: Put specific CSV files in ZIP files in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Put-specific-CSV-files-in-ZIP-files/m-p/727335#M28190</link>
    <description>&lt;P&gt;That is a contradiction. If they have different variables, they can't have the same structure. "Same structure" means the same variables with the same types and attributes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/353472"&gt;@mmea&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have table 1 to 5 - they all contain different data/varables but same structure and formats&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Mar 2021 09:36:31 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2021-03-18T09:36:31Z</dc:date>
    <item>
      <title>Put specific CSV files in ZIP files</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Put-specific-CSV-files-in-ZIP-files/m-p/727031#M28171</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a code that makes 25 CSV files.&lt;/P&gt;
&lt;P&gt;These files are based on 5 regions and each region has 5 files.&lt;/P&gt;
&lt;P&gt;I want to create 5 zipfiles for each regions, which includes the 5 files for each region.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I use this code to export to csv file (the 25 files), i use it in a macro to get the name of the file, so i my folder i get 25 files looking like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A_COVID19_TAB1_20210317.csv&lt;/P&gt;
&lt;P&gt;A_COVID19_TAB2_20210317.csv&lt;/P&gt;
&lt;P&gt;A_COVID19_TAB3_20210317.csv&lt;/P&gt;
&lt;P&gt;A_COVID19_TAB4_20210317.csv&lt;/P&gt;
&lt;P&gt;A_COVID19_TAB5_20210317.csv&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;B_COVID19_TAB1_20210317.csv&lt;/P&gt;
&lt;P&gt;B_COVID19_TAB2_20210317.csv&lt;/P&gt;
&lt;P&gt;B_COVID19_TAB3_20210317.csv&lt;/P&gt;
&lt;P&gt;B_COVID19_TAB4_20210317.csv&lt;/P&gt;
&lt;P&gt;B_COVID19_TAB5_20210317.csv&lt;/P&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;same for regioncode C, D, E&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to make 5 zip files for each code named:&lt;/P&gt;
&lt;P&gt;A_COVID19_20210317.zip&lt;/P&gt;
&lt;P&gt;B_COVID19_20210317.zip&lt;/P&gt;
&lt;P&gt;C_COVID19_20210317.zip&lt;/P&gt;
&lt;P&gt;D_COVID19_20210317.zip&lt;/P&gt;
&lt;P&gt;E_COVID19_20210317.zip&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let YYYYMMDD=%sysfunc(inputn(&amp;amp;DDMMMYYYY_h,best12.), YYMMDDN.6);

%macro regioncode(region);
%do i=1 %to 5;

proc export data=tabel&amp;amp;i. replace
  outfile="&amp;amp;out_folder.\&amp;amp;region._COVID19_TAB&amp;amp;i._&amp;amp;YYYYMMDD..csv"
  dbms=dlm
;
delimiter=';';
quit;


%regioncode(A);
%regioncode(B);
%regioncode(C);
%regioncode(D);
%regioncode(E);


%end;
%mend;


&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Mar 2021 09:33:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Put-specific-CSV-files-in-ZIP-files/m-p/727031#M28171</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2021-03-17T09:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: Put specific CSV files in ZIP files</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Put-specific-CSV-files-in-ZIP-files/m-p/727043#M28172</link>
      <description>&lt;P&gt;You can write your csv directly as a member into a ZIP file:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename zipfile zip '/folders/myfolders/myfile.zip';

data _null_;
set sashelp.class;
file zipfile(class.csv) dlm=";" dsd;
if _n_ = 1 then put "name;sex;age";
put name sex age;
run;

data _null_;
set sashelp.cars;
file zipfile(cars.csv) dlm=";" dsd;
if _n_ = 1 then put "make;model";
put make model;
run;

filename zipfile clear;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that the&lt;/P&gt;
&lt;PRE&gt;fileref(member)&lt;/PRE&gt;
&lt;P&gt;notation cannot be used in PROC EXPORT (it accepts only physical filenames), so you have to use DATA _NULL_ steps to write the csv content.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Mar 2021 10:14:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Put-specific-CSV-files-in-ZIP-files/m-p/727043#M28172</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-03-17T10:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: Put specific CSV files in ZIP files</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Put-specific-CSV-files-in-ZIP-files/m-p/727323#M28187</link>
      <description>&lt;P&gt;Can I do this in the same Macro as shown ?&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 08:23:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Put-specific-CSV-files-in-ZIP-files/m-p/727323#M28187</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2021-03-18T08:23:49Z</dc:date>
    </item>
    <item>
      <title>Re: Put specific CSV files in ZIP files</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Put-specific-CSV-files-in-ZIP-files/m-p/727325#M28188</link>
      <description>&lt;P&gt;Do all datasets have the same structure?&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 08:29:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Put-specific-CSV-files-in-ZIP-files/m-p/727325#M28188</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-03-18T08:29:01Z</dc:date>
    </item>
    <item>
      <title>Re: Put specific CSV files in ZIP files</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Put-specific-CSV-files-in-ZIP-files/m-p/727332#M28189</link>
      <description>&lt;P&gt;I have table 1 to 5 - they all contain different data/varables but same structure and formats&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 09:22:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Put-specific-CSV-files-in-ZIP-files/m-p/727332#M28189</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2021-03-18T09:22:56Z</dc:date>
    </item>
    <item>
      <title>Re: Put specific CSV files in ZIP files</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Put-specific-CSV-files-in-ZIP-files/m-p/727335#M28190</link>
      <description>&lt;P&gt;That is a contradiction. If they have different variables, they can't have the same structure. "Same structure" means the same variables with the same types and attributes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/353472"&gt;@mmea&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have table 1 to 5 - they all contain different data/varables but same structure and formats&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 09:36:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Put-specific-CSV-files-in-ZIP-files/m-p/727335#M28190</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-03-18T09:36:31Z</dc:date>
    </item>
  </channel>
</rss>

