<?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 copy views and indexes in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-copy-views-and-indexes/m-p/297430#M62454</link>
    <description>&lt;P&gt;Hi Michiel,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Will proc copy bring over the views?&amp;nbsp; I didn't think it did, but I could be wrong.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks&lt;/P&gt;</description>
    <pubDate>Fri, 09 Sep 2016 15:47:52 GMT</pubDate>
    <dc:creator>jerry898969</dc:creator>
    <dc:date>2016-09-09T15:47:52Z</dc:date>
    <item>
      <title>How to copy views and indexes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-copy-views-and-indexes/m-p/297419#M62448</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm making back up copies of directories on a SAS Share sever from a production SAS Share server.&amp;nbsp; I am able to create a macro to get a list of "DATA" tables and then create a copy of them in a new location.&amp;nbsp; My issue is that some of the locations I'm copying from have views (*.sas7bvew) and index (*.sas7bndx) files and I'm not sure how to make a copy in the new location.&amp;nbsp; In my code I'm looping through a list of libnames and taking the data tables and making a work copy then copying the table to my backup location.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data lib_list ;
	length lib $10 ;
	input lib $ ;	
cards;
Lib1
Lib2
Lib3
Lib4
;
run;

data _null_ ;
	set lib_list end = last ;
	call symput('libname'||trim(left((_n_))), trim(left(lib)) ) ;	
	call symput('nlibs', trim(left(_n_))) ;
run ;

%macro Get ;	
	%do i = 1 %to &amp;amp;nlibs. ;
		%let x=Share1 ;
		options comamid=tcp ;

		libname &amp;amp;&amp;amp;libname&amp;amp;i.  server=x.Shr1 access=readonly ;
		
		proc sql ;
		create table tabs
		as
		select *
		from dictionary.tables
		where libname = "&amp;amp;&amp;amp;libname&amp;amp;i."
		and memtype = 'DATA'
		;
		quit ;
		
		data _null_ ;
			set tabs end = last ;
			call symput('tabname'||trim(left((_n_))), trim(left(memname)) ) ;	
			call symput('ntabs', trim(left(_n_))) ;
		run ;
		
		%do j = 1 %to &amp;amp;ntabs. ;
			data &amp;amp;&amp;amp;tabname&amp;amp;j. ;
				set &amp;amp;&amp;amp;libname&amp;amp;i...&amp;amp;&amp;amp;tabname&amp;amp;j. ;
			run ;	
		%end ;
				
		%let w=Share2 ;
		options comamid=tcp ;
		libname &amp;amp;&amp;amp;libname&amp;amp;i.  server=w.Shr2 ;
				
		%do y = 1 %to &amp;amp;ntabs. ;
			data &amp;amp;&amp;amp;libname&amp;amp;i...&amp;amp;&amp;amp;tabname&amp;amp;y. ;
				set &amp;amp;&amp;amp;tabname&amp;amp;y. ;
			run ;	
		%end ;

		proc datasets lib=work nolist memtype=data ;
			save lib_list  ;
		quit ;
	%end ;
%mend Get ;

options mprint ;
%Get ;	&lt;/PRE&gt;
&lt;P&gt;Any help would be greatly appreciated.&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>Fri, 09 Sep 2016 15:19:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-copy-views-and-indexes/m-p/297419#M62448</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2016-09-09T15:19:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to copy views and indexes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-copy-views-and-indexes/m-p/297428#M62453</link>
      <description>&lt;P&gt;PROC COPY is not an option for you ?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Sep 2016 15:38:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-copy-views-and-indexes/m-p/297428#M62453</guid>
      <dc:creator>Michiel</dc:creator>
      <dc:date>2016-09-09T15:38:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to copy views and indexes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-copy-views-and-indexes/m-p/297430#M62454</link>
      <description>&lt;P&gt;Hi Michiel,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Will proc copy bring over the views?&amp;nbsp; I didn't think it did, but I could be wrong.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Fri, 09 Sep 2016 15:47:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-copy-views-and-indexes/m-p/297430#M62454</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2016-09-09T15:47:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to copy views and indexes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-copy-views-and-indexes/m-p/297440#M62461</link>
      <description>&lt;P&gt;I ran it again on a specific directory and it looks like it brought everything over.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Server 1 to Work
proc copy in=temp out=WORK constraint=yes index=yes ;			
run;

Work to Server 2
proc copy in=work out=temp2 constraint=yes index=yes ;			
run;&lt;/PRE&gt;
&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 09 Sep 2016 16:01:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-copy-views-and-indexes/m-p/297440#M62461</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2016-09-09T16:01:36Z</dc:date>
    </item>
  </channel>
</rss>

