<?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 Q1.Drop Datasets having 0 obs. Q2 Rename the first obs to Datasets in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Q1-Drop-Datasets-having-0-obs-Q2-Rename-the-first-obs-to/m-p/115290#M31872</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;RenaeQuery 1:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;i am Having Datasets in work some are having 0 obs how can i drop all the tables&lt;/P&gt;&lt;P&gt;Ex:&lt;BR /&gt;Dset&amp;nbsp; obs&lt;BR /&gt;Name1&amp;nbsp; 10 obs&lt;BR /&gt;Name2&amp;nbsp; 0 obs&lt;BR /&gt;Name3&amp;nbsp; 40 obs&lt;BR /&gt;Name4&amp;nbsp; 0 obs&lt;BR /&gt;ID1&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 obs&lt;BR /&gt;id2&amp;nbsp;&amp;nbsp;&amp;nbsp; 10 obs&lt;/P&gt;&lt;P&gt;i want to drop the obs with 0 records as i dont know how many datasets will be there&lt;BR /&gt;and with Differnt names&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Query 2:&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;I am having SAS DAtasets ex: x,y,z in this the first obs will have the dataset name i&lt;BR /&gt; want to rename the dataset name x to the name existing in first obs.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;In the above ex i gave x,y,z, but i dont know the exact names how can i do it.&lt;/P&gt;&lt;P&gt;Dataset x;&lt;BR /&gt;obs&lt;BR /&gt;1 Main Dataset&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 May 2012 07:17:06 GMT</pubDate>
    <dc:creator>sas_Forum</dc:creator>
    <dc:date>2012-05-15T07:17:06Z</dc:date>
    <item>
      <title>Q1.Drop Datasets having 0 obs. Q2 Rename the first obs to Datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Q1-Drop-Datasets-having-0-obs-Q2-Rename-the-first-obs-to/m-p/115290#M31872</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;RenaeQuery 1:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;i am Having Datasets in work some are having 0 obs how can i drop all the tables&lt;/P&gt;&lt;P&gt;Ex:&lt;BR /&gt;Dset&amp;nbsp; obs&lt;BR /&gt;Name1&amp;nbsp; 10 obs&lt;BR /&gt;Name2&amp;nbsp; 0 obs&lt;BR /&gt;Name3&amp;nbsp; 40 obs&lt;BR /&gt;Name4&amp;nbsp; 0 obs&lt;BR /&gt;ID1&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 obs&lt;BR /&gt;id2&amp;nbsp;&amp;nbsp;&amp;nbsp; 10 obs&lt;/P&gt;&lt;P&gt;i want to drop the obs with 0 records as i dont know how many datasets will be there&lt;BR /&gt;and with Differnt names&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Query 2:&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;I am having SAS DAtasets ex: x,y,z in this the first obs will have the dataset name i&lt;BR /&gt; want to rename the dataset name x to the name existing in first obs.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;In the above ex i gave x,y,z, but i dont know the exact names how can i do it.&lt;/P&gt;&lt;P&gt;Dataset x;&lt;BR /&gt;obs&lt;BR /&gt;1 Main Dataset&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2012 07:17:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Q1-Drop-Datasets-having-0-obs-Q2-Rename-the-first-obs-to/m-p/115290#M31872</guid>
      <dc:creator>sas_Forum</dc:creator>
      <dc:date>2012-05-15T07:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: Q1.Drop Datasets having 0 obs. Q2 Rename the first obs to Datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Q1-Drop-Datasets-having-0-obs-Q2-Rename-the-first-obs-to/m-p/115291#M31873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Q1:&lt;/P&gt;&lt;PRE&gt;data test;
input x;
datalines;
1
.
.
2
.
3
;
run;
data zero;
 set test;
 stop;
run;
data zero1;
 set test;
 stop;
run;

proc sql; 
select distinct memname into : list separated by ','
 from dictionary.tables
&amp;nbsp; where libname='WORK' and nobs=0;

drop table &amp;amp;list ;
quit;



&lt;/PRE&gt;&lt;P&gt;Q2:&lt;/P&gt;&lt;PRE&gt;data x;name='asa';run;
data y;name='asdsda';run;
data z;name='dsda';run;


proc sql noprint;
 select cats(' x=',name) into : x from x(obs=1);
 select cats(' y=',name) into : y from y(obs=1);
 select cats(' z=',name) into : z from z(obs=1);
quit;
proc datasets library=work nolist;
change&amp;nbsp; &amp;amp;x &amp;amp;y &amp;amp;z ;
quit;

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2012 07:43:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Q1-Drop-Datasets-having-0-obs-Q2-Rename-the-first-obs-to/m-p/115291#M31873</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-05-15T07:43:21Z</dc:date>
    </item>
    <item>
      <title>Re: Q1.Drop Datasets having 0 obs. Q2 Rename the first obs to Datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Q1-Drop-Datasets-having-0-obs-Q2-Rename-the-first-obs-to/m-p/115292#M31874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ksharp actually i am ahving 100 datsets in that condition how can i do it as i dont know the datasets it many&lt;/P&gt;&lt;P&gt;be like data1&amp;nbsp; up to data200 ,a,b,c,pdf,jkh&amp;nbsp; like dataset names in this how can i do&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2012 07:58:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Q1-Drop-Datasets-having-0-obs-Q2-Rename-the-first-obs-to/m-p/115292#M31874</guid>
      <dc:creator>sas_Forum</dc:creator>
      <dc:date>2012-05-15T07:58:51Z</dc:date>
    </item>
    <item>
      <title>Re: Q1.Drop Datasets having 0 obs. Q2 Rename the first obs to Datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Q1-Drop-Datasets-having-0-obs-Q2-Rename-the-first-obs-to/m-p/115293#M31875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use dictionary.members to query the table name and wrap them into a marco variable by SQL. It is easy.&lt;/P&gt;&lt;P&gt;Somebody will give you example. I have to leave now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2012 10:14:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Q1-Drop-Datasets-having-0-obs-Q2-Rename-the-first-obs-to/m-p/115293#M31875</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-05-15T10:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: Q1.Drop Datasets having 0 obs. Q2 Rename the first obs to Datasets</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Q1-Drop-Datasets-having-0-obs-Q2-Rename-the-first-obs-to/m-p/115294#M31876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, This is my attempt trying to be somebody.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _x;name='asa';run;&lt;/P&gt;&lt;P&gt;data _y;name='asdsda';run;&lt;/P&gt;&lt;P&gt;data _z;name='dsda';run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql NOPRINT;&lt;/P&gt;&lt;P&gt;select cats(memname,'(obs=1)') into :memname SEPARATED BY ' ' from dictionary.tables where libname='WORK';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;length name $10.;&lt;/P&gt;&lt;P&gt;set &amp;amp;MEMNAME indsname=dsn;&lt;/P&gt;&lt;P&gt;dsname=scan(dsn,-1,'.');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql NOPRINT;&lt;/P&gt;&lt;P&gt;select cats(dsname,'=',name) into: change separated by ' ' from have;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc datasets library=work nolist;&lt;/P&gt;&lt;P&gt;change &amp;amp;change;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, Ksharp for the insight!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2012 20:18:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Q1-Drop-Datasets-having-0-obs-Q2-Rename-the-first-obs-to/m-p/115294#M31876</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-05-15T20:18:02Z</dc:date>
    </item>
  </channel>
</rss>

