<?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 Keep à column in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Keep-%C3%A0-column/m-p/658914#M197392</link>
    <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I would like to keep the first column from table SAS. I know the Label name but I don’t know the name of this varaiable. Proc content can’t help. Do you have some ideas?&lt;BR /&gt;Thank you very much!&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Marie</description>
    <pubDate>Mon, 15 Jun 2020 10:49:51 GMT</pubDate>
    <dc:creator>SASdevAnneMarie</dc:creator>
    <dc:date>2020-06-15T10:49:51Z</dc:date>
    <item>
      <title>Keep à column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-%C3%A0-column/m-p/658914#M197392</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I would like to keep the first column from table SAS. I know the Label name but I don’t know the name of this varaiable. Proc content can’t help. Do you have some ideas?&lt;BR /&gt;Thank you very much!&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Marie</description>
      <pubDate>Mon, 15 Jun 2020 10:49:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-%C3%A0-column/m-p/658914#M197392</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2020-06-15T10:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: Keep à column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-%C3%A0-column/m-p/658918#M197395</link>
      <description>&lt;P&gt;Lets try to identify the columns name based on the column position, in your example we need to identify the first column so we need to use dictionary.columns as below so based on where varnum variable you will know the column orders and the first column will have varnum=1 and from the name column you will know the variable name to use further. Try this on you dataset&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as select * from dictionary.columns where libname='SASHELP' and memname='CLASS';
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/43216iE69B84462A762B49/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 10:55:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-%C3%A0-column/m-p/658918#M197395</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2020-06-15T10:55:10Z</dc:date>
    </item>
    <item>
      <title>Re: Keep à column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-%C3%A0-column/m-p/658921#M197396</link>
      <description>&lt;P&gt;Alternatively by proc contents as well you will know the column position and variable name as below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents data=sashelp.class;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 604px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/43217i0F3EE997EDE39FB2/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 10:57:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-%C3%A0-column/m-p/658921#M197396</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2020-06-15T10:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: Keep à column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-%C3%A0-column/m-p/658925#M197398</link>
      <description>&lt;P&gt;Why would you say "&lt;SPAN&gt;&amp;nbsp;Proc content can’t help" .&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Once running the following code you could get the first variable name .&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;data have;
 set sashelp.class;
 label name='xxxxxx' age='yyyyyy';
run;

proc contents data=have varnum;
run;&lt;/PRE&gt;
&lt;PRE&gt;                                      Variables in Creation Order

                                #    Variable    Type    Len    Label

                                1    Name        Char      8    xxxxxx
                                2    Sex         Char      1
                                3    Age         Num       8    yyyyyy
                                4    Height      Num       8
                                5    Weight      Num       8
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Or Try following code .&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;data _null_;
 set have;
 array n{*} _numeric_;
 array c{*} _character_;
 do i=1 to dim(n);
   if vlabel(n{i})='xxxxxx' then call symputx('first_name',vname(n{i}));
 end;
 do i=1 to dim(c);
   if vlabel(c{i})='xxxxxx' then call symputx('first_name',vname(c{i}));
 end;
run;

data want;
 set have;
 drop &amp;amp;first_name;
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Jun 2020 11:21:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-%C3%A0-column/m-p/658925#M197398</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-06-15T11:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: Keep à column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-%C3%A0-column/m-p/658929#M197401</link>
      <description>&lt;P&gt;The VNEXT call routine will iterate through the PDV variable names.&amp;nbsp; The first call will return the first variable name.&lt;/P&gt;
&lt;P&gt;Use the returned variable name in a DOSUBL function call that runs a 'slicing' step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  if 0 then set &lt;FONT size="4"&gt;&lt;STRONG&gt;sashelp.cars&lt;/STRONG&gt;&lt;/FONT&gt;;
  length _name_ $32;
  call vnext(_name_);

  rc = dosubl("data want; set &lt;FONT size="4"&gt;&lt;STRONG&gt;sashelp.cars&lt;/STRONG&gt;&lt;/FONT&gt; (keep=" || trim(_name_) || ");");

  stop;
run;
&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Jun 2020 11:37:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-%C3%A0-column/m-p/658929#M197401</guid>
      <dc:creator>RichardDeVen</dc:creator>
      <dc:date>2020-06-15T11:37:40Z</dc:date>
    </item>
  </channel>
</rss>

