<?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 keep the dataset label while dropping few variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-keep-the-dataset-label-while-dropping-few-variables/m-p/592652#M169950</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/62004"&gt;@vraj1&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use PROC SQL to drop the variables in order to preserve the dataset label, e.g., like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;call execute(
"proc sql; alter table &amp;amp;outlib.." || compress(dataset) || " drop " 
|| translate(trim(varlist),',',' ')|| "; quit;"
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(Ideally, you would create VARLIST as a comma-separated list in the first place.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 30 Sep 2019 13:05:09 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2019-09-30T13:05:09Z</dc:date>
    <item>
      <title>how to keep the dataset label while dropping few variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-keep-the-dataset-label-while-dropping-few-variables/m-p/592639#M169946</link>
      <description>&lt;P&gt;I have a code where i am dropping variables which are not needed but it also removes the label of the datasets. Can anyone help me in how to prevent it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;code used is&amp;nbsp;&lt;/P&gt;
&lt;P&gt;call execute(&lt;BR /&gt;"data &amp;amp;outlib.." || compress(dataset) || "(drop=" || trim(varlist)&lt;BR /&gt;|| ");" || "set &amp;amp;outlib.." || compress(dataset)&lt;BR /&gt;|| ";" || "run;"&lt;BR /&gt;);&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2019 12:07:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-keep-the-dataset-label-while-dropping-few-variables/m-p/592639#M169946</guid>
      <dc:creator>vraj1</dc:creator>
      <dc:date>2019-09-30T12:07:10Z</dc:date>
    </item>
    <item>
      <title>Re: how to keep the dataset label while dropping few variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-keep-the-dataset-label-while-dropping-few-variables/m-p/592652#M169950</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/62004"&gt;@vraj1&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use PROC SQL to drop the variables in order to preserve the dataset label, e.g., like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;call execute(
"proc sql; alter table &amp;amp;outlib.." || compress(dataset) || " drop " 
|| translate(trim(varlist),',',' ')|| "; quit;"
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(Ideally, you would create VARLIST as a comma-separated list in the first place.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2019 13:05:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-keep-the-dataset-label-while-dropping-few-variables/m-p/592652#M169950</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-09-30T13:05:09Z</dc:date>
    </item>
    <item>
      <title>Re: how to keep the dataset label while dropping few variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-keep-the-dataset-label-while-dropping-few-variables/m-p/593670#M170411</link>
      <description>&lt;P&gt;This is failing if my varlist has only one variable to drop&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"proc sql; alter table &amp;amp;out.." || compress(dataset) || " drop " &lt;BR /&gt;|| translate(trim(compbl(varlist)),',',' ')|| "; quit;"&lt;BR /&gt;);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I get the below error:&lt;/P&gt;
&lt;P&gt;3 + proc sql;&lt;BR /&gt;NOTE: Line generated by the CALL EXECUTE routine.&lt;BR /&gt;3 + alter table sE drop ,BEY;&lt;BR /&gt;-&lt;BR /&gt;22&lt;BR /&gt;ERROR 22-322: Expecting a name.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2019 11:12:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-keep-the-dataset-label-while-dropping-few-variables/m-p/593670#M170411</guid>
      <dc:creator>vraj1</dc:creator>
      <dc:date>2019-10-03T11:12:33Z</dc:date>
    </item>
    <item>
      <title>Re: how to keep the dataset label while dropping few variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-keep-the-dataset-label-while-dropping-few-variables/m-p/593677#M170416</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/62004"&gt;@vraj1&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The problem is actually not that &lt;FONT face="courier new,courier"&gt;varlist&lt;/FONT&gt; contains only one variable name, but that it apparently contains a &lt;EM&gt;leading blank&amp;nbsp;&lt;/EM&gt;(which is then "TRANSLATEd" into a leading comma, which in turn is invalid after "DROP"). The solution is very easy: Just replace "&lt;FONT face="courier new,courier"&gt;trim&lt;/FONT&gt;" by "&lt;FONT face="courier new,courier"&gt;strip&lt;/FONT&gt;" to remove both trailing &lt;EM&gt;and leading&lt;/EM&gt; blanks from &lt;FONT face="courier new,courier"&gt;varlist&lt;/FONT&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(The risk of stray blanks being translated into commas was the reason why I recommended a&amp;nbsp;&lt;SPAN&gt;comma-separated list in &lt;FONT face="courier new,courier"&gt;varlist&lt;/FONT&gt;.)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2019 11:42:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-keep-the-dataset-label-while-dropping-few-variables/m-p/593677#M170416</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2019-10-03T11:42:20Z</dc:date>
    </item>
  </channel>
</rss>

